[Libav-user] I'll ask in other words - how can I force input frame rate?

wl2776 wl2776 at gmail.com
Mon Oct 10 08:54:44 CEST 2011

Steffen Ebersbach-2 wrote:
>> wl2776 wrote:
>> So, it is possible to force input frame rate. How can I do it in my
>> application?
> Hello,
> in an own application you have to do this resampling by your self. If 
> you have 2fps input and 25fps output, it means that you have to write 
> each picture from the input 12,5 times to the output. In fact this is 
> not possible, so you have to do 12 and 13 pictures for each second. The 
> code should look like this

Thank you for the answer, but you've misunderstood me.
My problem is that functions avformat_open_input() and
avformat_find_stream_info() incorrectly determine frame rate, incorrectly
assign values to AVFormatContext/AVStream members (time_base, what else, I
don't know) and, since that, av_read_frame returns frames having incorrect

I tried using av_rescale_q() to recalculate timestamps, but the resulting
value are like the following (dts, pts): (0, 0), (0, 0), (0, 0), (1, 1), (1,

And when I pass the last AVPacket, having pts = dts = 1, to the
av_interleaved_write_frame(), it complains that "application has provided
non-monotonically increasing timestamps".

View this message in context: http://libav-users.943685.n4.nabble.com/How-can-I-emulate-r-switch-programmatically-tp3874115p3889356.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list