What does the video output stream details from ffmpeg mean?

When you run ffmpeg -i with the video file as input parameter, ffmpeg returns some details of the stream type, like codec, bitrate and resolution. What does the other data mean - "tbr", "tbn" and "tbc"? From my examples below, you can see that they vary a lot.

Stream #0.0(und): Video: h264, yuv420p, 1280x720, 25 tbr, 25 tbn, 50 tbc

Stream #0.0(eng): Video: h264, yuv420p, 640x480, 22050 tbr, 22050 tbn, 44100 tbc

Stream #0.1: Video: wmv3, yuv420p, 1280x720, 4000 kb/s, 29.97 tbr, 1k tbn, 1k tbc

Secondary question: why is not bitrate always shown?


Solution 1:

What you see is the reciprocal of the time stamp bases used in FFmpeg and the en/decoders. I can't explain it better, therefore just quoting the FFmpeg mailing list:

tbn is the time base in AVStream that has come from the container, I think. It is used for all AVStream time stamps.

tbc is the time base in AVCodecContext for the codec used for a particular stream. It is used for all AVCodecContext and related time stamps.

tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate, except sometimes it is twice what one would expect because of field rate versus frame rate.

In the end, you want to take tbr as the value one mostly refers to as "framerate".

Bitrate is not always shown as video streams might contain variable bitrate content – in that case, you couldn't really estimate the bitrate. For constant bitrate streams, bitrate is usually shown. There are some cases where variable bitrates are used and FFmpeg shows the average – at least with h.264 video this sometimes works.

Video: h264, yuv420p, 640x480, 22050 tbr, 22050 tbn, 44100 tbc seems more like an audio stream, obviously.