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".
[FFmpeg-user] Odd video output, playing RTSP on RPI
Hi guys. I am trying to use ffplay for viewing an RTSP stream on a RPI. i use this command : "sudo ffplay -rtsp_transport tcp -rtsp_flags prefer_tcp rtsp://192.168.1.138:8554/unicast" . my RPI is running a headless raspian installation. the output result is somewhat odd though. i see the RTSP stream in the lower left corner of the screen at a very low frame rate (1 frame /10s) and then i also see a mouse pointer above the RTSP stream area. i assume i use the wrong output , but i am not sure. i would like to play the RTSP stream at 25FPS in fullscreen. can any of you guys help me with that ? ___ 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] Local latency with FFplay
> On 22 Apr 2021, at 18:05, Carl Zwanzig wrote: > > On 4/22/2021 12:43 AM, Bouke wrote: >> Trying to view a stream while recording. (That 'sorta kinda' works with a >> tee and udp streaming, but has a horrible delay.) >> Ideal would be to keep FFplay open, and start / stop FFmpeg for >> recording, or just viewing the incoming signal. > The BMD recorder app does a rather good job of that You mean Media Express? Yes, that has just a little latency, but is too limited for my purpose. > >> This results in a latency of 6 seconds (Ok, no local file, but with it >> and a tee it’s the same) > Have you tried > different encodings? Yes, but that’s no issue, the encoding is fast enough > tee-ing raw frames into both a viewer and a separate encoder? How would I go about that? And, how should that help ’not’ filling the buffer that FFplay reads out, introducing the latency? > IIRC the ffmpeg decklink code has a few frames of latency, but not more than > that. OTOH, how many does the x264 encoder have? Very little, that’s not the issue > (I'll assume the encoder can keep up with the incoming frames.) At least for > the viewing part, you shouldn't use -any- encoding since those same frames > will then have to be decoded for display. (If you're using ffplay to monitor > the recording -after- encoding, they you have to live with the encoder's > latency.) Just cursed and googled more, -fflags nobuffer solves it! Thanks for putting me on the right track Bouke > Later, > > z! > ___ > 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". ___ 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".