[Libav-user] Encoding with variable frame rate

Brad O'Hearne brado at bighillsoftware.com
Tue May 21 15:35:38 CEST 2013


On May 21, 2013, at 12:12 AM, Robert Krüger <krueger at lesspain.de> wrote:
> are you talking about using the ffmpeg as a command line application?

No, using libraries programmatically in an app.

> you elaborate what exactly you mean by "but FFmpeg must have fixed
> frame rate"?

In my testing, you have to feed the encoder the exact number of FPS set in time_base.den. You cannot give the encoder some lesser or greater FPS and think that accommodating this by setting pts will fix the timing. Playback is going to process time_base.den frames per second, so if you give it fewer FPS than time_base.den, then your video is going to play back faster than intended, and if you give it greater FPS than time_base.den, then your video is going to play back slower than intended. 

The upshot is that you are pinned to a fixed frame rate while encoding. If your source data provides are a variable frame rate, then you have some work to do to feed a fixed frame rate to the encoder.

That was my experience. If there are other nuances which can positively affect the situation, I'm not aware of them -- perhaps someone else can expound on those if they exist..

Good luck, 

Brad


More information about the Libav-user mailing list