[Libav-user] Encoding with variable frame rate
krueger at lesspain.de
Tue May 21 15:50:57 CEST 2013
On Tue, May 21, 2013 at 3:35 PM, Brad O'Hearne
<brado at bighillsoftware.com> wrote:
> 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.
That sounds weird. "Playback is going to process time_base.den frames
per second". Where is that? It seems you're assuming (inverse)
timebase == framerate which is only one special case. Anyway, a player
reading a quicktime file should not assume any frame rate but display
the samples with the timings/durations that are encoded in the
quicktime file. So I am not sure if you're saying the resulting
quicktime file is incorrect because of an ffmpeg limitation or that a
specific player does not play VFR files correctly. My understanding is
that _if_ the ffmpeg mov muxer supports VFR (despite what the flag
says, see Carl's mail with the referenced commit by Baptiste) you
should not have to do anything with frame rate as you would only need
to decide on a timebase that has the granularity required to describe
your captured frames' timestamps and then rescale incoming timestamps,
durations to that timescale before feeding it to the mov muxer. Maybe
I will try that at some point but right now I'm asking this rather
because of a general interest in the state of the mov muxer than
having a pressing need to get it working.
More information about the Libav-user