[Libav-user] DTS audio out of sync with video
scott.brown at movenetworks.com
Tue Feb 7 21:58:34 CET 2012
I'm using ffmpeg libraries to read from a UDP transport stream, and I've been working on handling short term signal loss if ffmpeg can no longer read from the UDP stream. Basically the call to av_read_frame() takes a long time (up to a minute or so) and then begins reading packets again.
The trouble I have is with the PTS and DTS for the audio and video. Specifically, the audio and video are no longer in sync. The audio is about 2 seconds before the video. So if a video frame has the same PTS as a audio frame, during playback the video looks like it's behind the audio, even though the PTS is the same. Interestingly enough, this only happens after signal loss. If there is no signal loss, everything looks great.
For a transport stream, is the PTS/DTS dependent on the packets before it? I've tried clearing out the AVFormatContext packet_buffer via calling the ff_frame_flush function, but this didn't help. Does anyone know why the audio and video get out of sync if packets are lost?
Thanks for the help.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user