Re: [FFmpeg-user] How to filter time dependent
Am 24.04.2021 um 19:24 schrieb Michael Koch: Am 23.04.2021 um 23:19 schrieb Ulf Zibis: Am 23.04.21 um 08:31 schrieb Gyan Doshi: On this topic generally, see https://superuser.com/q/1632998/ Much thanks for this hint. I was successful with this approach: ffmpeg -i 'Stille Tage in Clichy.mpg' -vf "split=3[a][b][c];[a]trim=0:2888.36,setpts=PTS-STARTPTS,crop=352:496:0:36[a];[b]trim=2888.36:3293.96,setpts=PTS-STARTPTS,crop=352:496:0:42[b];[c]trim=3293.96,setpts=PTS-STARTPTS,crop=352:496:0:38[c];[a][b][c]concat=n=3:v=1:a=0",scale=iw:ih/2,hqdn3d=2:1.5:12 -preset slow -movflags +faststart 'Stille Tage in Clichy_c_3_scale_1_2_hqdn3d_2_1_12_slow.mp4' You can simplify this by using sendcmd: ffmpeg -i input.mp4 -vf "sendcmd=f=test.cmd,crop@1=352:496:0:36,scale=iw:ih/2,hqdn3d=2:1.5:12 out.mp4 I forgot the quotation mark " at the end of the filter chain: ffmpeg -i input.mp4 -vf "sendcmd=f=test.cmd,crop@1=352:496:0:36,scale=iw:ih/2,hqdn3d=2:1.5:12" out.mp4 "@1" can be omitted if there is only one crop filter in the filter chain. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.2021 um 23:19 schrieb Ulf Zibis: Am 23.04.21 um 08:31 schrieb Gyan Doshi: On this topic generally, see https://superuser.com/q/1632998/ Much thanks for this hint. I was successful with this approach: ffmpeg -i 'Stille Tage in Clichy.mpg' -vf "split=3[a][b][c];[a]trim=0:2888.36,setpts=PTS-STARTPTS,crop=352:496:0:36[a];[b]trim=2888.36:3293.96,setpts=PTS-STARTPTS,crop=352:496:0:42[b];[c]trim=3293.96,setpts=PTS-STARTPTS,crop=352:496:0:38[c];[a][b][c]concat=n=3:v=1:a=0",scale=iw:ih/2,hqdn3d=2:1.5:12 -preset slow -movflags +faststart 'Stille Tage in Clichy_c_3_scale_1_2_hqdn3d_2_1_12_slow.mp4' You can simplify this by using sendcmd: ffmpeg -i input.mp4 -vf "sendcmd=f=test.cmd,crop@1=352:496:0:36,scale=iw:ih/2,hqdn3d=2:1.5:12 out.mp4 The file "test.cmd" contains these two lines: 2888.36 crop@1 y 42; 3293.96 crop@1 y 38; The above example is untested. There is a similar example at the end of chapter 2.86 in my book: http://www.astro-electronic.de/FFmpeg_Book.pdf Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.21 um 21:20 schrieb Leo Butler via ffmpeg-user: I would put the select filters before filter_A, etc., rather than after. I would use the concat filter at the end to concatenate the streams. Otherwise, out.mp4 ends with 3 parallel video streams. May be that would work, but I didn't test it, as I was successful with "trim". On the other hand, if you have frame information, then you can use 'between(n,startframe,endframe)' in place of 'between(t,starttime,endtime)'. --- As a sidenote, for this sort of thing, it would be *really* nice if ffplay could display frame numbers (and/or pts) and print them to stdout. + 1 from my side. -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.21 um 08:31 schrieb Gyan Doshi: On this topic generally, see https://superuser.com/q/1632998/ Much thanks for this hint. I was successful with this approach: ffmpeg -i 'Stille Tage in Clichy.mpg' -vf "split=3[a][b][c];[a]trim=0:2888.36,setpts=PTS-STARTPTS,crop=352:496:0:36[a];[b]trim=2888.36:3293.96,setpts=PTS-STARTPTS,crop=352:496:0:42[b];[c]trim=3293.96,setpts=PTS-STARTPTS,crop=352:496:0:38[c];[a][b][c]concat=n=3:v=1:a=0",scale=iw:ih/2,hqdn3d=2:1.5:12 -preset slow -movflags +faststart 'Stille Tage in Clichy_c_3_scale_1_2_hqdn3d_2_1_12_slow.mp4' The advantage of "trim" over "between(...)" is, that the upper border is exclusive (so no worry about missing frames) and it is also stated, that it accepts duration time syntax from https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax . But "trim=0‘12:03:45’ doesn't work here, as colons are ambiguously used as separators for the parameters. Does anyone know, how to effectively escape the colons? -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Ulf Zibis writes: > 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,1)),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,1)'",filter_D > out.mp4 I would put the select filters before filter_A, etc., rather than after. I would use the concat filter at the end to concatenate the streams. Otherwise, out.mp4 ends with 3 parallel video streams. On the other hand, if you have frame information, then you can use 'between(n,startframe,endframe)' in place of 'between(t,starttime,endtime)'. --- As a sidenote, for this sort of thing, it would be *really* nice if ffplay could display frame numbers (and/or pts) and print them to stdout. Leo > > With this I got a weird file with 3 video streams: > > $ ffmpeg -i 'Stille Tage in Clichy.mpg' -filter_complex > "split=3[a][b][c];[a]crop=352:496:0:36[d];[b]crop=352:496:0:42[e];[c]crop=352:496:0:38[f];[d]select='between(t,0,2888.3)';[e]select='between(t,2888.3,3293.88)';[f]select='between(t,3293.88,1)'",scale=iw:ih/2,hqdn3d=2:1.5:12 > -movflags +faststart 'Stille Tage in > Clichy_c_3_scale_1_2_hqdn3d_2_1_12.mp4' > ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) > 2000-2020 the FFmpeg developers > built with gcc 8 (Debian 8.3.0-6) > configuration: --enable-gpl --enable-version3 --enable-static > --disable-debug --disable-ffplay --disable-indev=sndio > --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r > --enable-gnutls --enable-gmp --enable-libgme --enable-gray > --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf > --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb > --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband > --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis > --enable-libopus --enable-libtheora --enable-libvidstab > --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp > --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d > --enable-libxvid --enable-libzvbi --enable-libzimg > libavutil 56. 51.100 / 56. 51.100 > libavcodec 58. 91.100 / 58. 91.100 > libavformat 58. 45.100 / 58. 45.100 > libavdevice 58. 10.100 / 58. 10.100 > libavfilter 7. 85.100 / 7. 85.100 > libswscale 5. 7.100 / 5. 7.100 > libswresample 3. 7.100 / 3. 7.100 > libpostproc 55. 7.100 / 55. 7.100 > Input #0, mpeg, from 'Stille Tage in Clichy.mpg': > Duration: 01:00:00.49, start: 0.529989, bitrate: 2917 kb/s > Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top > first), 352x576 [SAR 24:11 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc > Side data: > cpb: bitrate max/min/avg: 9578800/0/0 buffer size: 1835008 vbv_delay: > N/A > Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s > File 'Stille Tage in Clichy_c_3_scale_1_2_hqdn3d_2_1_12.mp4' already exists. > Overwrite? [y/N] y > Stream mapping: > Stream #0:0 (mpeg2video) -> split (graph 0) > select (graph 0) -> Stream #0:0 (libx264) > select (graph 0) -> Stream #0:1 (libx264) > hqdn3d (graph 0) -> Stream #0:2 (libx264) > Stream #0:1 -> #0:3 (mp2 (native) -> aac (native)) > Press [q] to stop, [?] for help > [libx264 @ 0x5f9c440] using SAR=24/11 > [libx264 @ 0x5f9c440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 > Cache64 > [libx264 @ 0x5f9c440] profile High, level 2.1, 4:2:0, 8-bit > [libx264 @ 0x5f9c440] 264 - core 161 r3018 db0d417 - H.264/MPEG-4 AVC > codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - > options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 > psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 > 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 > threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 > interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 > b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 > keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf > mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 > aq=1:1.00 > [libx264 @ 0x602a4c0] using SAR=24/11 > [libx264 @ 0x602a4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 > Cache64 >
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.2021 um 15:58 schrieb Ulf Zibis: Am 23.04.21 um 08:07 schrieb Michael Koch: The "between" function is including at both ends of the interval. Thanks for the info. Oh what a pitty ... imagine I set the upper border of the lower range to 10:23.59, the lower border of the upper range to 10:23.60 and there is a frame at 10:23.595. Then this frame would not be catched by both ranges. untested command line, second try with streamselect filter: ffmpeg -i input.mp4 -lavfi split=3[a][b][c];[a]filter_A[d];[b]filter_B[e];[c]filter_C[f];[d][e][f]streamselect=inputs=3:map='gt(t,1000)+gt(t,2000)',filter_D out.mp4 The expression for "map" is 0 for t<=1000, 1 for t>1000 and 2 for t>2000. If you want a "greater or equal" expression, use "gte" instead of "gt". Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.21 um 08:07 schrieb Michael Koch: The "between" function is including at both ends of the interval. Thanks for the info. Oh what a pitty ... imagine I set the upper border of the lower range to 10:23.59, the lower border of the upper range to 10:23.60 and there is a frame at 10:23.595. Then this frame would not be catched by both ranges. So I think, it would be better to change this to always determine a upper border exclusive, even for -t, -to, -ss etc. -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.2021 um 14:05 schrieb Nicolas George: Michael Koch (12021-04-23): The crop filter could be used to change the x,y coordinates, with constant output resolution. With timeline? Please elaborate? Please forget what I wrote. It's wrong. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.21 um 13:56 schrieb Michael Koch: Am 23.04.2021 um 13:35 schrieb Nicolas George: Ulf Zibis (12021-04-23): I already had checked that. Unfortunately, crop has no timeline support: How would that work? Enabling or disabling crop changes the output resolution, which is not supported by libavfilter. The crop filter could be used to change the x,y coordinates, with constant output resolution. Yes, as you can see from my command line, I use constant output resolution with crop. -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Michael Koch (12021-04-23): > The crop filter could be used to change the x,y coordinates, with constant > output resolution. With timeline? Please elaborate? Regards, -- Nicolas George ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.2021 um 13:35 schrieb Nicolas George: Ulf Zibis (12021-04-23): I already had checked that. Unfortunately, crop has no timeline support: How would that work? Enabling or disabling crop changes the output resolution, which is not supported by libavfilter. The crop filter could be used to change the x,y coordinates, with constant output resolution. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Gyan Doshi (12021-04-23): > Strictly, it's supported via -noautoscale (which you reviewed), but it's > not supported by (almost) any encoder. No, it is not *supported*, it is a fragile hack. *Supporting* resolution changes will require a lot more work. Regards, -- Nicolas George ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
On 2021-04-23 17:05, Nicolas George wrote: Ulf Zibis (12021-04-23): I already had checked that. Unfortunately, crop has no timeline support: How would that work? Enabling or disabling crop changes the output resolution, which is not supported by libavfilter. Strictly, it's supported via -noautoscale (which you reviewed), but it's not supported by (almost) any encoder. However, the crop result can be consumed before buffersink, e.g. as an overlay. I've done this many times. Regards, Gyan ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Ulf Zibis (12021-04-23): > I already had checked that. Unfortunately, crop has no timeline support: How would that work? Enabling or disabling crop changes the output resolution, which is not supported by libavfilter. Regards, -- Nicolas George ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Thanks ... Am 23.04.21 um 09:04 schrieb Michael Koch: Please have a look at the "streamselect" filter instead of "select". Will do later. 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 I already had checked that. Unfortunately, crop has no timeline support: $ ffmpeg -filters | grep crop ..C crop V->V Crop the input video. T.. cropdetect V->V Auto-detect crop size. -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
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,1)),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,1)'",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 Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 23.04.2021 um 08:31 schrieb Gyan Doshi: You may be thinking of the interleave filter. select uses exactly one input. you are right and what I wrote was wrong. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
On 2021-04-23 11:37, Michael Koch wrote: 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,1)),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,1)'",filter_D out.mp4 With this I got a weird file with 3 video streams: I think in this example it's not correct how you are using the select filter. The select filter needs two or more inputs, and it selects one of them and passes this stream to the output. You may be thinking of the interleave filter. select uses exactly one input. On this topic generally, see https://superuser.com/q/1632998/ Regards, Gyan ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
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,1)),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,1)'",filter_D out.mp4 With this I got a weird file with 3 video streams: I think in this example it's not correct how you are using the select filter. The select filter needs two or more inputs, and it selects one of them and passes this stream to the output. The "between" function is including at both ends of the interval. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
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,1)),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,1)'",filter_D out.mp4 With this I got a weird file with 3 video streams: $ ffmpeg -i 'Stille Tage in Clichy.mpg' -filter_complex "split=3[a][b][c];[a]crop=352:496:0:36[d];[b]crop=352:496:0:42[e];[c]crop=352:496:0:38[f];[d]select='between(t,0,2888.3)';[e]select='between(t,2888.3,3293.88)';[f]select='between(t,3293.88,1)'",scale=iw:ih/2,hqdn3d=2:1.5:12 -movflags +faststart 'Stille Tage in Clichy_c_3_scale_1_2_hqdn3d_2_1_12.mp4' ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mpeg, from 'Stille Tage in Clichy.mpg': Duration: 01:00:00.49, start: 0.529989, bitrate: 2917 kb/s Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 352x576 [SAR 24:11 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc Side data: cpb: bitrate max/min/avg: 9578800/0/0 buffer size: 1835008 vbv_delay: N/A Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s File 'Stille Tage in Clichy_c_3_scale_1_2_hqdn3d_2_1_12.mp4' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 (mpeg2video) -> split (graph 0) select (graph 0) -> Stream #0:0 (libx264) select (graph 0) -> Stream #0:1 (libx264) hqdn3d (graph 0) -> Stream #0:2 (libx264) Stream #0:1 -> #0:3 (mp2 (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0x5f9c440] using SAR=24/11 [libx264 @ 0x5f9c440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x5f9c440] profile High, level 2.1, 4:2:0, 8-bit [libx264 @ 0x5f9c440] 264 - core 161 r3018 db0d417 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [libx264 @ 0x602a4c0] using SAR=24/11 [libx264 @ 0x602a4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x602a4c0] profile High, level 2.1, 4:2:0, 8-bit [libx264 @ 0x602a4c0] 264 - core 161 r3018 db0d417 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
Re: [FFmpeg-user] How to filter time dependent
Am 22.04.21 um 21:59 schrieb Jim DeLaHunt: On 2021-04-22 08:26, Ulf Zibis wrote: …with exact frame count instead unsing -ss, which only counts in seconds? Just to be sure the obvious is stated out loud: the parameter to -ss can be a floating-point number, meaning you can make it as precise as you like, to indicate the time when you expect a specific frame. e.g. "-ss 22.0393" . Well yes, I know, thanks for your thoughts. But I would feel better and more exact with frame counts. Imagine I create a series of pics to find out the time where I should switch to the other filter: ffmpeg -i IN.mpg -ss 48:07.50 -frames:v 50 'OUT_%03d.jpg' (the videos fps is 25) Imagine, that OUT_021.jpg is the first frame for the other filter. Then I could do: ffmpeg -i input.mp4 -filter_complex split[a][b];[a]filter_A[c];[b]filter_B[d];[c][d]select='between(t,0,48:08.30)',filter_C out.mp4 If OUT_021.jpg is at 0,48:08.299, it will be filtered with filter_A, If it is at 0,48:08.30, I don't know, as I don't know if select treats the upper border inclusive or exclusive of 0,48:08.30, and if it is at 0,48:08.301, it will be filtered with filter_B. -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
On 2021-04-22 08:26, Ulf Zibis wrote: …with exact frame count instead unsing -ss, which only counts in seconds? Just to be sure the obvious is stated out loud: the parameter to -ss can be a floating-point number, meaning you can make it as precise as you like, to indicate the time when you expect a specific frame. e.g. "-ss 22.0393" . ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
Am 22.04.21 um 13:01 schrieb Michael Koch: 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,1)),filter_C out.mp4 Much thanks for this great help. To find the time, from where I will change the filter, I did: ffmpeg -i IN.mpg -ss 48:07.50 -frames:v 50 'OUT_%03d.jpg' (the videos fps is 25) But his gives me only an estimation. Is there a way to seek in the stream with exact frame count instead unsing -ss, which only counts in seconds? -Ulf ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] How to filter time dependent
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,1)),filter_C out.mp4 Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".