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

Steffen Ebersbach ebersbac at hs-mittweida.de
Mon Oct 10 09:08:27 CEST 2011

Am 10.10.2011 08:54, schrieb wl2776:
> 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 
> PTS/DTS. 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, 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". 

Sry, excuse me.
Now your problem is clear. You write that the timestamps of the mjpeg 
frames are stored separately? That means libav don't see them? I think 
his is the reason for the wrong entries in avstream/ Fomartcontext. In 
this situation the best way i think, ist to manage the pts/dts values by 
your self. for mpeg-ts 25fps the right pts are 3600, 7200, ... , because 
the time_base is 90000 and the delay is 40 ms.


Dipl.-Ing.(FH) Steffen Ebersbach
Hochschule Mittweida (FH)
University of Applied Sciences
Forschungsgruppe Optronik
Technikumplatz 17
09648 Mittweida

e-mail ebersbac at hs-mittweida.de
Telefon 03727 58-1113

More information about the Libav-user mailing list