Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques How to choose a transcode framerate when source fps and tbr don’t match

  • How to choose a transcode framerate when source fps and tbr don’t match

    Posted by Christopher Smith on August 26, 2010 at 11:27 pm

    Hi,

    I have a video source I need to transcode for delivery over the web. I would normally try to maintain the source frame rate but in this case the rate seems odd and the tbr value is different.

    This is how ffmpeg describes the source video.
    Stream #0.1(eng): Video: h264, yuv420p, 1920×1080, 8136 kb/s, 22.58 fps, 23.98 tbr, 2997 tbn, 5994 tbc

    If I transcode it at -r 22.58 the transcoded video is
    Stream #0.0(eng): Video: h264, yuv420p, 768×432, 706 kb/s, 22.58 fps, 22.58 tbr, 1129 tbn, 45.16 tbc

    and ffmpeg reports “Seems stream 0 codec frame rate differs from container frame rate: 45.16 (1129/25) -> 22.58 (1129/50)”.

    If I transcode it at -r 23.98 the transcoded video is
    Stream #0.0(eng): Video: h264, yuv420p, 768×432, 705 kb/s, 23.97 fps, 23.98 tbr, 1199 tbn, 47.96 tbc

    and ffmpeg reports the same “Seems stream 0 codec frame rate differs from container frame rate: 47.96 (1199/25) -> 23.98 (1199/50)”.

    Does anyone know how I can configure ffmpeg to maintain the same frame rate and timing as in the original?

    Michael Rampe replied 15 years, 11 months ago 2 Members · 1 Reply
  • 1 Reply
  • Michael Rampe

    August 30, 2010 at 7:41 am

    Your source file reported:
    [Christopher Smith] “22.58 fps, 23.98 tbr, 2997 tbn, 5994 tbc”
    Is this 24 fps material in a ntsc stream using 3:2 pulldown?

    tbn, tbc & tbr all refer to the timebase. (AVStream, AVCodecContext, assumed). This can differ between container, codec and assumed rate. (due to some containers being able to hold both interlaced and non-interlaced material, the time base can be double the required frame rate and these warnings are normal in that case.) fps refers to the frame rate but I find this can be inaccurate.

    IMHO, tbr is the most trustworthy.

    For example, if I do a header read of one of my test animation files I get:
    Seems stream 0 codec frame rate differs from container frame rate: 600.00 (600/1) -> 25.00 (25/1)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘fluid8.mov’:
    Metadata:
    major_brand : qt
    minor_version : 537199360
    compatible_brands: qt
    Duration: 00:00:08.64, start: 0.000000, bitrate: 68055 kb/s
    Stream #0.0(eng): Video: qtrle, rgb24, 1024×576, 68053 kb/s, 24.65 fps, 25 tbr, 600 tbn, 600 tbc

    This is a .mov container holding video in the animation codec at 25 frames per second (I know this because I made it ;-). In this example, you can see that tbr is the only correct one and that would also be the correct choice for -r if I wanted to force the frame rate. You can always just exclude the -r flag and the frame rates will pass from source to destination.

    Finally, be careful of rounding errors using 23.98. (It is actually 23.976 which is 30/1.001/1.25)

    Michael

    p.s. Please always post full command lines.

    “half-way to world domination A.K.A. the belligerent blue bike shed”

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy