[Libav-user] Muxing mpeg4-ts and raw audio to AVI file

Dmitry Gorbunov atskiisotona at gmail.com
Mon Aug 15 19:01:28 CEST 2011

Nicholas Butts wrote:
> I am not currently using avcodec_decode_video

Input packets still contains correct pts values produced by hardware

Probably you have to set output_video_stream->start_time to correct value
(it must be equal to first packet's pts).

Your problem is probably in audio and video not synchronized. I.e. you get
video stream with certain time_base, start_time and pts values in packets,
and you get audio stream with different parameters, and video/audio are
totally out of sync. On synthetic data from muxing example it's okay. But in
real life it's not. That's why players show weird results. Basically video
and audio packets pts should correspond to each other (accordingly to video
and audio stream time_base, so they are not necessary the same values). pts
can be described as time from stream->start_time and when the packet gets
displayed/played. pts is not in seconds, but in time_base units, that's why
audio and video pts can be different, but player will calculate correct time
in milliseconds using stream time_base.

View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Muxing-mpeg4-ts-and-raw-audio-to-AVI-file-tp3740515p3745121.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list