[libav-api] Encoding video with non-fixed FPS
lu_zero at gentoo.org
Thu Dec 29 15:36:44 CET 2011
On 29/12/11 15:10, Soren Dreijer wrote:
> Thanks, Luca.
> I need to write both audio and video, so I *have* to use interleaved
> frames, right?
Depends on your container. You might not want to use the default frame
interleaver in some cases.
> I was trying to read up on the pts value yesterday, but I'm a little
> unclear what to set it to. I have the time the packet was captured (in
> milliseconds) and the time of the first packet in the stream, but I'm
> not sure how that fits in with the AVStream->time_base units. If I'm
> capping at 25 FPS, do I simply calculate (from my own timestamps)
> which frame I'm passing the encoder?
you decide the timebase and put the time reference in timebase units,
that means that if the timebase is 1/1000 s and your frame is around
1/25 s, your pts would be about 40 timebase unit apart each other.
> What if packets are dropped? Do I need to manually feed the encoder
> the previous frame for all the dropped frames, or does the encoder
> know how to handle this case if there's a gap in the pts value?
the encoder does not care about timing. It process frames as they go.
More information about the libav-api