[Ffmpeg-devel] Audio/Video Syncing...

Michael Niedermayer michaelni
Sat Oct 14 02:06:50 CEST 2006


On Fri, Oct 13, 2006 at 05:58:57PM -0500, Ryan Martell wrote:
> Hi--
> I have implented the rtsp streaming over h264.  Everything works  
> against Darwin Streaming Server (packetization mode 1 & 2).  The only  
> problem is that I can't figure out what I'm doing wrong on getting  
> the audio/video to sync.
> I have called this on the stream:
>     av_set_pts_info(stream, 33, 1, 90000)
> And 90kHz is the standard for h264 streaming.
> When I let ffmpeg figure out the frame rate, sometimes it shows up as  
> 10 fps(r), and other times it shows up at 29.97 fps(r).
> If I hardcode the fps (num=30000, and den= 1001), it will still  
> sometimes playback at 10.

well the question here is what is the real framerate of the stream
or in other words how many frames do you pass to libavformat per
second? and what is the difference between the pts values of the
frames you pass to lavf

> When I enable DEBUG_SYNC in ffplay, the pts value I'm giving it  
> starts off around -9000 (this is because there is no rtcp packet yet  
> to sync the timebase to, I think), then jumps to 0, and proceeds to  
> go up from there.  The A-V delay will end up around 11 seconds at  
> times, other times it will be closer to zero.

does the delay stay constant or does it increase?

and can you elaborate on the rtcp packet sync thing ...

> I suspect there is something obvious that I'm not doing, but I don't  
> know where to look.

well, are the pts values on the audio and video AVPackets you output
correct? (a simple printf which prints them should awnser that, a
10 second difference should be pretty easy to spot ...)

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list