193

I am using ffmpeg to tell me video info. Specifically:

ffmpeg -i video.ext

I get the output:

Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 704x576 [PAR 12:11 DAR 4:3], 9578 kb/s, 25 tbr, 90k tbn, 50 tbc

Does anyone know what tbr, tbn and tbc are exactly? I have seen speculation on the net but nothing definitive?

paper1111
  • 4,245
  • 2
  • 21
  • 40
user7289
  • 25,989
  • 27
  • 64
  • 86

1 Answers1

216

Well it's all about time. FFMpeg uses in fact three different timestamps in different bases in order to work.

  • tbn = the time base in AVStream that has come from the container
  • tbc = the time base in AVCodecContext for the codec used for a particular stream
  • tbr = tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate

This was also asked on the FFmpeg mailing lists: What does the output of ffmpeg mean? tbr tbn tbc etc?

slhck
  • 30,965
  • 24
  • 125
  • 174
Oleiade
  • 5,618
  • 4
  • 24
  • 41
  • 7
    Thanks for this - the way 'I think' was used in these posts - I wasn't sure whether it was 'fact' or 'opinion'. How does TBR relate to frame per second exactly and under what conditions do they differ and why? – user7289 Jul 07 '10 at 23:05
  • 3
    tbr is the framerate that the demuxer should use. in newer versions, ffmepg/avlib will even call it outright `fps`. here is a newer version output: `Stream #0.0[0x1011]: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 90k tbn, 47.95 tbc` – gcb Mar 25 '16 at 22:52
  • 6
    Also see [this answer](https://stackoverflow.com/a/9400527/4720018) and the ffmpeg [source](https://github.com/FFmpeg/FFmpeg/blob/e5c11ab9cef60a6c9141d7a60145ea833dd88485/libavformat/dump.c#L509) – djvg Sep 25 '17 at 08:31
  • 13
    "the time base in AVStream that has come from the container" is a meaningless sentence. – Chloe Sep 29 '18 at 06:04
  • 1
    @Chloe how is it meaningless? – Gyan Sep 29 '18 at 12:53
  • 21
    @Gyan What is a "time base"? What is an "AVStream"? What is a "container"? Why would a time value come from a container? Isn't time objective? Same with all 3. This answer needs more words. Try rewording it first with the smallest number of basic English words, then second, append a longer version with many more words describing each jargon term in plain language, and how they related to each other, with examples. – Chloe Sep 29 '18 at 17:34
  • 7
    @Chloe time base: basis from which timing of frames is determined; avstream: audio/video sequential data; container: file format that can contain channels of audio/video data, such as avi, mp4, or mkv; these are digital video words, likely from the ffmpeg source, but I think what you are saying is that the answer does not explain these ffmpeg terms, which is valid. – fuzzyTew Apr 11 '19 at 15:30
  • The answer has some value, but it doesn't answer the question – Rugnar Jan 22 '21 at 11:44
  • Just spent a while figuring this out. Context: video and audio are each encoded using a **codec** (e.g., H.264), then stored together in a **container** (e.g., MP4). Both containers & codecs have a concept of time -- how long is the video, when does each frame start? These times are measured in ticks. In the codec, one frame might start at tick 10, and the next at tick 12. In the container, an audio track might be 1000 ticks long. The **timebase** is the number of ticks in each second. The key here is that the timebase can be different for the container (**tbn**) and the codec (**tbc**). – ianh Feb 27 '21 at 16:43
  • 1
    this answer is helpful in describing these conceptual terms: https://stackoverflow.com/a/43337235/127971 – michael Feb 28 '21 at 08:14