FORUMS: list search recent posts

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

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Christopher Smith
How to choose a transcode framerate when source fps and tbr don't match
on Aug 26, 2010 at 11:27:38 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, 1920x1080, 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, 768x432, 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, 768x432, 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?


Return to posts index

Michael Rampe
Re: How to choose a transcode framerate when source fps and tbr don't match
on Aug 30, 2010 at 7:41:26 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, 1024x576, 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"


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]