[FFmpeg-user] How to filter time dependent

Michael Koch astroelectronic at t-online.de
Fri Apr 23 10:04:13 EEST 2021

Am 22.04.2021 um 23:27 schrieb Ulf Zibis:
> Am 22.04.21 um 13:01 schrieb Michael Koch:
>> Am 22.04.2021 um 12:50 schrieb Ulf Zibis:
>>> Hi,
>>> I want to filter a video from pts 0 to 1999 with filter A, then from 
>>> 2000 to 2199 with filter B, from 2200 with filter A and finally the 
>>> whole stream with filter C.
>>> Can one please give me an example for a working command line?
>> untested:
>> ffmpeg -i input.mp4 -lavfi 
>> split[a][b];[a]filter_A[c];[b]filter_B[d];[c][d]select=bitor(between(t,0,1999),between(t,2200,10000)),filter_C 
>> out.mp4
> I found out, that the 'between(t,a,b)' should be surrounded by colons.
> But anyway the reality is more complex. I have to use 3 different 
> filters. So I tried:
> ffmpeg -i input.mp4 -filter_complex 
> "split[a][b][c];[a]filter_A[d];[b]filter_B[e];[c]filter_C[f];[d]select='between(t,0,1999)';[e]select='between(t,2000,2199)';[f]select='between(t,2200,10000)'",filter_D 
> out.mp4

Sorry that my example was wrong. Please have a look at the 
"streamselect" filter instead of "select".
However the problem might be easier to solve if your filters A, B and C 
have timeline support with "enable" option. Use this command to find out 
if your filters have timeline support:
ffmpeg -filters


More information about the ffmpeg-user mailing list