Alex
Alex

Reputation: 1053

What does the output of `ffmpeg` mean?

I am converting a file, and here is the output. This question has a partial answer here, so I am asking about the parts not covered by it. I've adjusted the width of the terminal to preserve the output history

[olpc@laptop ~] ffmpeg -i input -c:a copy -s 384x216 output
ffmpeg version N-68778-g5c7227b Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 29 2014 22:12:54 with gcc 4.9.2 (GCC)

...

frame=2   fps=0.0 q=0.0  size=     0kB time=00:00:00.00 bitrate=   0.0kbits/s
frame=3   fps=2.0 q=0.0  size=     0kB time=00:00:00.00 bitrate=   0.0kbits/s
frame=5   fps=2.4 q=0.0  size=     0kB time=00:00:00.00 bitrate=   0.0kbits/s
frame=8   fps=2.9 q=0.0  size=     0kB time=00:00:00.00 bitrate=   0.0kbits/s
frame=10  fps=2.8 q=0.0  size=     0kB time=00:00:00.00 bitrate=   0.0kbits/s
frame=12  fps=2.9 q=0.0  size=     0kB time=00:00:00.00 bitrate=   0.0kbits/s
frame=13  fps=2.8 q=0.0  size=     0kB time=00:00:00.02 bitrate=  16.5kbits/s
frame=16  fps=3.1 q=0.0  size=     0kB time=00:00:00.48 bitrate=   0.8kbits/s
frame=19  fps=3.2 q=0.0  size=     0kB time=00:00:00.48 bitrate=   0.8kbits/s
frame=21  fps=3.2 q=0.0  size=     0kB time=00:00:00.48 bitrate=   0.8kbits/s

...

frame=687 fps=0.6 q=29.0 size=  1245kB time=00:00:22.84 bitrate= 446.5kbits/s
frame=688 fps=0.6 q=29.0 size=  1246kB time=00:00:22.84 bitrate= 446.7kbits/s
frame=689 fps=0.6 q=29.0 size=  1248kB time=00:00:22.84 bitrate= 447.5kbits/s
frame=690 fps=0.6 q=29.0 size=  1249kB time=00:00:22.84 bitrate= 447.8kbits/s
frame=691 fps=0.6 q=29.0 size=  1249kB time=00:00:22.84 bitrate= 448.0kbits/s
frame=692 fps=0.6 q=29.0 size=  1251kB time=00:00:22.84 bitrate= 448.7kbits/s
frame=693 fps=0.6 q=29.0 size=  1252kB time=00:00:22.84 bitrate= 448.8kbits/s
frame=694 fps=0.6 q=29.0 size=  1253kB time=00:00:22.84 bitrate= 449.1kbits/s
frame=695 fps=0.6 q=29.0 size=  1254kB time=00:00:22.84 bitrate= 449.7kbits/s
frame=696 fps=0.6 q=29.0 size=  1255kB time=00:00:22.84 bitrate= 449.9kbits/s
frame=697 fps=0.6 q=29.0 size=  1256kB time=00:00:22.84 bitrate= 450.2kbits/s
frame=698 fps=0.6 q=29.0 size=  1256kB time=00:00:22.84 bitrate= 450.3kbits/s
frame=699 fps=0.6 q=29.0 size=  1258kB time=00:00:22.84 bitrate= 451.0kbits/s
frame=699 fps=0.6 q=29.0 size=  1258kB time=00:00:22.87 bitrate= 450.5kbits/s
frame=701 fps=0.6 q=29.0 size=  1261kB time=00:00:23.31 bitrate= 443.1kbits/s

The second segment took 20 seconds: 1 second per each line until the last one, and the last one took 6 seconds before being displayed. This pattern is repeating for the entire length of the file. The way I understand it is, that there is a control frame in the video every 15 frames, and while there is no control frame the video is processed at 1fps.

Now, my question is: what is time referring to? It seems to refer to the time in the video, but why does it stand still for the first 13 frames, and then creep up by 0.03 second, before jumping by 0.44 seconds?

Also, how can the bitrate jump from 0.0 to 16.5 back to 0.8? (the above lines all updated one second apart). I mean, if after 7 seconds the bitrate is 16.5kbit/s, then it must have updated at least 105.5kbits. That means that even if it processes nothing the next second, the bit rate would be at least 13.2kbit/s after the next (8th) second.

Finally, what does q stand for?

Upvotes: 2

Views: 970

Answers (1)

Alex
Alex

Reputation: 1053

Partial answer:

The bitrate is computed by (amount of file processed) / (amount of time into the video). When the time into the file is 0, the quotient above is undefined, so the bitrate gets listed as 0.0kbits/sec.

Thus, when the read is 0.02 seconds into the file, then the output file size must be (16.5kbit/s) * (0.02 s) = 0.33kbits, hence it still rounds to size=0kB. However, when at the next iteration the read is 0.48 seconds into the file, then 0.33kbit / 0.48 second = 0.7kbits/s. Which means that between frame 13 and frame 16, the output file size does increase, since the output speed now says 0.8kbits / s.

The reason it lists 0.02 seconds is because at that point, it has stopped using one frame completely. Because the second control frame occurs after 15 frames, by the next second it has also stopped using the other 14 frames of the incoming video, so the next second shows it not needing anything before the next control frame, namely 0.48 seconds into the video. Note that it is doing the same partial jump before the full jump at every control frame.

Upvotes: 2

Related Questions