[Ffmpeg-devel] AV Synchronization question

Michael Niedermayer michaelni
Fri Jan 26 15:59:05 CET 2007


On Fri, Jan 26, 2007 at 03:39:05PM +0100, Emanuele Fumagalli wrote:
> Sorry to bother again but I got no answers from the other mailing list (I 
> guess there are only people who just use the executables).
> So I'll try posting here
> My player simply has a thread that decodes frames, so I repeatedly call 
> av_read_frame(m_Context, &pkt) and I decode the packets (audio and video) 
> put them in separated queues and redender them as fast as I can from 
> externals threads (video and audio).
> I get good results but on some kind of files the audio-video synchro is 
> very bad (mov files: h264 video, aac audio).
> My first question is: how come that the timing is correct, I mean I get a 
> frame every framerate ms without performing any timing delay, 

either pure luck (=slow cpu) or your source limits it (RTP?) or your audio
hardware limits it based on the samplerate you set and a limited queues size

> what should I 
> do to decode faster ?(not waiting the right delay between frames)

prevent the things i mentioned above

> Then I'd like to know how to sync av better.
> Is there some code examples (apart ffplay.c) or some tips to do that?

ffplay is a good example ...
you simply have to look at the dts of the packets and wait in either the
decoder or render threads ...

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070126/01243e42/attachment.pgp>

More information about the ffmpeg-devel mailing list