[FFmpeg-user] Stats

Moritz Barsnick barsnick at gmx.net
Mon Sep 7 22:12:59 CEST 2015


On Mon, Sep 07, 2015 at 16:54:00 +0100, Tom Evans wrote:
> ffmpeg -y -i in.mkv -t 30 out.mov 2>&1 | tr '\r' '\n' |grep ^frame=
> 
> frame=   89 fps=0.0 q=28.0 size=      97kB time=00:00:03.94 bitrate=
> 202.0kbits/s
> frame=  115 fps=110 q=28.0 size=     416kB time=00:00:04.97 bitrate=
> 684.8kbits/s
> frame=  139 fps= 88 q=28.0 size=     699kB time=00:00:06.05 bitrate=
> 945.0kbits/s
> frame=  161 fps= 77 q=28.0 size=    1003kB time=00:00:07.08
> bitrate=1160.4kbits/s
> frame=  184 fps= 71 q=28.0 size=    1393kB time=00:00:07.80
> bitrate=1461.8kbits/s
> 
> Parse that in to CSV however you like.

Because I happened to fiddle with that code section recently, I know
there is already a way to get that information into a nicely parsable
file: Using the "-progress" option:

$ ffmpeg -progress file:/tmp/progress.txt [...]

I believe it is updated just as often as those lines you grepped above,
but in a nice linear file as such:

frame=454
fps=0.0
stream_0_0_q=-0.0
bitrate=N/A
total_size=N/A
out_time_ms=18160000
out_time=00:00:18.160000
dup_frames=0
drop_frames=0
progress=continue
frame=920
fps=919.0
stream_0_0_q=-0.0
bitrate=N/A
total_size=N/A
out_time_ms=36800000
out_time=00:00:36.800000
dup_frames=0
drop_frames=0
progress=continue
[...]

(Note that each block begins with "frame=".)

Moritz


More information about the ffmpeg-user mailing list