[FFmpeg-user] How can I pipe ffmpeg listing?

Francois Visagie francois.visagie at gmail.com
Wed Feb 5 21:47:04 EET 2020


> -----Original Message-----
> From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of
> Mark Filipak
> Sent: 05 February 2020 18:42
> To: ffmpeg-user at ffmpeg.org
> Subject: Re: [FFmpeg-user] How can I pipe ffmpeg listing?
> 
> On 02/05/2020 09:37 AM, Moritz Barsnick wrote:
> 
> Hi, Moritz, and Thanks.
> 
> > On Tue, Feb 04, 2020 at 23:17:28 -0500, Mark Filipak wrote:
> >> This:
> >>    >ffmpeg -ss 2:00 -i g:\VIDEO_TS\VTS_02_2.VOB -filter:v idet -frames:v
> >> 900 -an -f rawvideo -y NUL
> >> produces the listing at the bottom -- it is that listing that I'm trying
> >> to pipe.
> >
> > With "listing", do you mean these lines?
> >> [Parsed_idet_0 @ 0000015ef0c72840] Repeated Fields: Neither:   772 Top:
> 66 Bottom:    63
> >> [Parsed_idet_0 @ 0000015ef0c72840] Single frame detection: TFF:   687
> BFF:     1 Progressive:   159 Undetermined:    54
> >> [Parsed_idet_0 @ 0000015ef0c72840] Multi frame detection: TFF:   901
> BFF:     0 Progressive:     0 Undetermined:     0
> >
> > These are emitted by the idet filter using ffmpeg's logging mechanism,
> > which goes to stderr (the shell's standard error stream). You cannot
> > change that target from the ffmpeg command line tool.
> >
> >> Redirection to a file doesn't work, either.
> >
> > To capture the log messages behind a '|' pipe, you need to redirect the
> > stderr stream to stdout. I have no idea how to do that on Windows. A
> > search on the net tells me to use "2>&1", like in a Unix Bourne shell.
> 
> Thanks! This:
> ffmpeg -ss 2:00 -i %1 -filter:v idet -frames:v 900 -an -f rawvideo -y
> NUL 2>&1 | FINDSTR "Parsed_idet"
> works. (At the bottom of this message is my script and its output.)

Great.

For future reference you could also redirect stderr separately and directly to a file:
ffmpeg ... 2>logfile.txt

> 
> What I'm trying to do is find where a video switches between hard- &
> soft-telecine. I could dump the applicable frame metadata
> 
> progressive_sequence
> picture_structure
> top_field_first
> repeat_first_field
> progressive_frame
> 
> and interpret the dump via a script, but I haven't found a way to dump
> the metadata.
> 
> Thanks for your help.
> 
> ===== SCRIPT =====
> 
> @ECHO.
> @ECHO ======================= 2 minutes
> =======================
> @ffmpeg -hide_banner -ss 2:00 -i %1 -filter:v idet -frames:v 900 -an -f
> rawvideo -y NUL 2>&1 | FINDSTR "Input Output Video: frame= Parsed_idet"
> @ECHO.
> @ECHO ======================= 6 minutes
> =======================
> @ffmpeg -hide_banner -ss 6:00 -i %1 -filter:v idet -frames:v 900 -an -f
> rawvideo -y NUL 2>&1 | FINDSTR "Input Output Video: frame= Parsed_idet"
> @ECHO.
> @ECHO ====================== 10 minutes
> =======================
> @ffmpeg -hide_banner -ss 10:00 -i %1 -filter:v idet -frames:v 900 -an -f
> rawvideo -y NUL 2>&1 | FINDSTR "Input Output Video: frame= Parsed_idet"
> @ECHO.
> @ECHO ====================== 14 minutes
> =======================
> @ffmpeg -hide_banner -ss 14:00 -i %1 -filter:v idet -frames:v 900 -an -f
> rawvideo -y NUL 2>&1 | FINDSTR "Input Output Video: frame= Parsed_idet"
> @ECHO.
> @ECHO ====================== 18 minutes
> =======================
> @ffmpeg -hide_banner -ss 18:00 -i %1 -filter:v idet -frames:v 900 -an -f
> rawvideo -y NUL 2>&1 | FINDSTR "Input Output Video: frame= Parsed_idet"
> @ECHO.
> @CMD /K
> 
> ===== SCRIPT OUTPUT =====
> 
> ======================= 2 minutes =======================
> Input #0, mpeg, from 'G:\VIDEO_TS\VTS_02_2.VOB':
>      Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top
> first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97
> tbr, 90k tbn, 59.94 tbc
> Output #0, rawvideo, to 'NUL':
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480
> [SAR 32:27 DAR 16:9], q=2-31, 124291 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
> frame=  900 fps=0.0 q=-0.0 Lsize=  455625kB time=00:00:30.03
> bitrate=124291.7kbits/s speed=43.8x
> [Parsed_idet_0 @ 00000258997ba500] Repeated Fields: Neither:   772 Top:
>    66 Bottom:    63
> [Parsed_idet_0 @ 00000258997ba500] Single frame detection: TFF:   687
> BFF:     1 Progressive:   159 Undetermined:    54
> [Parsed_idet_0 @ 00000258997ba500] Multi frame detection: TFF:   901
> BFF:     0 Progressive:     0 Undetermined:     0
> 
> ======================= 6 minutes =======================
> Input #0, mpeg, from 'G:\VIDEO_TS\VTS_02_2.VOB':
>      Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top
> first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97
> tbr, 90k tbn, 59.94 tbc
> Output #0, rawvideo, to 'NUL':
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480
> [SAR 32:27 DAR 16:9], q=2-31, 124291 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
> frame=  900 fps=0.0 q=-0.0 Lsize=  455625kB time=00:00:30.03
> bitrate=124291.7kbits/s speed=  41x
> [Parsed_idet_0 @ 00000213df83a500] Repeated Fields: Neither:   650 Top:
>   128 Bottom:   123
> [Parsed_idet_0 @ 00000213df83a500] Single frame detection: TFF:   714
> BFF:     0 Progressive:   169 Undetermined:    18
> [Parsed_idet_0 @ 00000213df83a500] Multi frame detection: TFF:   900
> BFF:     0 Progressive:     0 Undetermined:     1
> 
> ====================== 10 minutes =======================
> Input #0, mpeg, from 'G:\VIDEO_TS\VTS_02_2.VOB':
>      Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top
> first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97
> tbr, 90k tbn, 59.94 tbc
> Output #0, rawvideo, to 'NUL':
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480
> [SAR 32:27 DAR 16:9], q=2-31, 124291 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
> frame=  900 fps=0.0 q=-0.0 Lsize=  455625kB time=00:00:30.03
> bitrate=124291.7kbits/s dup=180 drop=0 speed=47.9x
> [Parsed_idet_0 @ 000002029e5aa500] Repeated Fields: Neither:   721 Top:
>     0 Bottom:     0
> [Parsed_idet_0 @ 000002029e5aa500] Single frame detection: TFF:     0
> BFF:     0 Progressive:   715 Undetermined:     6
> [Parsed_idet_0 @ 000002029e5aa500] Multi frame detection: TFF:     0
> BFF:     0 Progressive:   721 Undetermined:     0
> 
> ====================== 14 minutes =======================
> Input #0, mpeg, from 'G:\VIDEO_TS\VTS_02_2.VOB':
>      Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top
> first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97
> tbr, 90k tbn, 59.94 tbc
> Output #0, rawvideo, to 'NUL':
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480
> [SAR 32:27 DAR 16:9], q=2-31, 124291 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
> frame=  900 fps=0.0 q=-0.0 Lsize=  455625kB time=00:00:30.03
> bitrate=124291.7kbits/s dup=179 drop=0 speed=56.6x
> [Parsed_idet_0 @ 000001f59fc6a500] Repeated Fields: Neither:   720 Top:
>     1 Bottom:     1
> [Parsed_idet_0 @ 000001f59fc6a500] Single frame detection: TFF:     4
> BFF:     0 Progressive:   453 Undetermined:   265
> [Parsed_idet_0 @ 000001f59fc6a500] Multi frame detection: TFF:   209
> BFF:     0 Progressive:   513 Undetermined:     0
> 
> ====================== 18 minutes =======================
> Input #0, mpeg, from 'G:\VIDEO_TS\VTS_02_2.VOB':
>      Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top
> first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97
> tbr, 90k tbn, 59.94 tbc
> Output #0, rawvideo, to 'NUL':
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480
> [SAR 32:27 DAR 16:9], q=2-31, 124291 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
> frame=  900 fps=0.0 q=-0.0 Lsize=  455625kB time=00:00:30.03
> bitrate=124291.7kbits/s dup=180 drop=0 speed=50.6x
> [Parsed_idet_0 @ 000001b91fb9a500] Repeated Fields: Neither:   721 Top:
>     0 Bottom:     0
> [Parsed_idet_0 @ 000001b91fb9a500] Single frame detection: TFF:     0
> BFF:     0 Progressive:   690 Undetermined:    31
> [Parsed_idet_0 @ 000001b91fb9a500] Multi frame detection: TFF:     0
> BFF:     0 Progressive:   721 Undetermined:     0
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list