[FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters
Marton Balint
cus at passwd.hu
Thu Sep 6 23:20:54 EEST 2018
On Sat, 1 Sep 2018, Bodecs Bela wrote:
> Hi Balint,
>
>
> 2018.08.25. 20:35 keltezéssel, Marton Balint írta:
>> To delay filtering until a given wallclock timestamp.
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>> doc/filters.texi | 36 ++++++++++
>> libavfilter/Makefile | 2 +
>> libavfilter/allfilters.c | 2 +
>> libavfilter/f_cue.c | 182 +++++++++++++++++++++++++++++++++++++++++++++++
>> libavfilter/version.h | 2 +-
>> 5 files changed, 223 insertions(+), 1 deletion(-)
>> create mode 100644 libavfilter/f_cue.c
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 32c95b591c..79eec0c808 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -551,6 +551,11 @@ Set LFO range.
>> Set LFO rate.
>> @end table
>>
>> + at section acue
>> +
>> +Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
>> +filter.
>> +
>> @section adeclick
>> Remove impulsive noise from input audio.
>>
>> @@ -6987,6 +6992,37 @@ indicates 'never reset', and returns the largest area encountered during
>> playback.
>> @end table
>>
>> + at anchor{cue}
>> + at section cue
>> +
>> +Delay video filtering until a given wallclock timestamp. The filter first
>> +passes on @option{preroll} amount of frames, then it buffers at most
>> + at option{buffer} amount of frames and waits for the cue. After reaching the cue
>> +it forwards the buffered frames and also any subsequent frames coming in its
>> +input.
>> +
>> +The filter can be used synchronize the output of multiple ffmpeg processes for
>> +realtime output devices like decklink. By putting the delay in the filtering
>> +chain and pre-buffering frames the process can pass on data to output almost
>> +immediately after the target wallclock timestamp is reached.
>> +
>> +Perfect frame accuracy cannot be guaranteed, but the result is good enough for
>> +some use cases.
> just for my curiousity, will you please give an example/use_case how to
> use these filters?
Here is a shell script:
#!/bin/bash
UNIX_TIMESTAMP=`date +%s`
TS=$((UNIX_TIMESTAMP*1000000 + 2500000))
ffmpeg -nostdin -nostats -stream_loop -1 -i input1.mp4 \
-vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
-af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (1)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input2.mp4 \
-vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
-af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (2)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input3.mp4 \
-vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
-af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (3)" &
ffmpeg -nostdin -nostats -stream_loop -1 -i input4.mp4 \
-vf "format=uyvy422,cue=$TS:preroll=0.5:buffer=0.5" \
-af "acue=$TS:preroll=0.5:buffer=0.5" -f decklink "DeckLink Duo (4)" &
We are doing something similar to drive 16 TVs in a studio set
simultaneously.
Regards,
Marton
More information about the ffmpeg-devel
mailing list