[FFmpeg-devel] [PATCH] Fix various design problems with complex graphs
nicolas.george at normalesup.org
Fri Apr 20 12:31:39 CEST 2012
The incoming patch series start to fix various design problems with complex
filtergraphs inside ffmpeg. An example of such a problem is the fact that:
-filter_complex 'split[a][b]' -map '[a]' filea -map '[b]' fileb
will produce an empty fileb. Another problem is that -vf tile will produce a
lot of warnings, but that is less surprising as I wrote vf_tile that way.
[PATCH 1/8] avfilter: document request_frame return codes.
[PATCH 2/8] avfilter: add a pointer from links to graph.
Simple, necessary for #3 and #4.
[PATCH 3/8] avfilter: keep a list of sink links by age.
[PATCH 4/8] avfiltergraph: add avfilter_graph_request_oldest().
Used to trigger data movement in the graph. See the comments in the patch
[PATCH 5/8] vsrc_buffer: return EAGAIN if no frame is available.
The model I propose is "request and see if data comes", then requesting when
no data is available is not an error.
[PATCH 6/8] vsrc_buffer: count the number of failed requests.
This one is part of something I did not implement yet. See below.
[PATCH 7/8] buffersink: add AV_BUFFERSINK_FLAG_NO_REQUEST.
It could be done with "if (peek_buffer()) get_buffer()", but it is neater
[PATCH 8/8] ffmpeg: directly request frames from filters.
This is the main change in ffmpeg.c, see comments in the patch itself.
For reference, make fate (without samples, but the filter tests do not use
samples) still succeeds after this patch series.
Two elements remain unimplemented, but are not strictly necessary for it to
First, the selection of the next input file: currently, ffmpeg chooses the
file with the latest timestamp. But the filters can completely change the
timestamps. A correct selection would look at the timestamps of the output
streams, and see the what input they are connected. That is the purpose of
patch #6: we request a frame on the latest output and see to what input(s)
they end end up.
Second, I need to figure out a scenario where the fact that several streams
are interleaved in the same file may cause a problem.
Clément, are you still working on audio filtering? I do not know if you
looked at it recently, but I believe that Anton's work on complex
filtergraphs will make it much easier to implement.
More information about the ffmpeg-devel