[Live-devel] rtsp with a/v synchronization

Ross Finlayson finlayson at live555.com
Fri Aug 24 03:52:38 PDT 2007


>Hi Ross,
>
>Thank you for offering us this nice library to learn more about streaming.
>
>I am just writing a test application for H.264 and AAC multicast streaming
>with the help of FAQ and previous discussions. After some tests, I found some
>problem with a/v synchronization that I can not understand.
>I use the frame rate and sampling rate to put the right timestamps 
>and time duration for every frame video and audio ( I can stream 
>them seperately and receive them normally). However, when I stream 
>them together(which include a rtsp server). I use rtsp protocol to 
>get the a/v stream by VLC, I found the a/v is a bit of out of sync. 
>The audio is always a little bit of behind video.
>I am not sure whether this is related to I put the different 
>timestamps for the first frame of video and audio since I use the 
>gettimeofday for the first time.

Yes, if you give accurate - wall-clock synchronized - presentation 
times to the data that you feed to your "RTPSink" (subclass), *and* 
if you have a "RTCPInstance" for each "RTPSink" (subclass), then 
these presentation times will be returned - at the client end - when 
it reads from the corresponding "RTPSource" (subclass).


>Another interesting thing I found is that if the VLC can receive the 
>first frame audio and video, the sync effect become much better(I 
>did this by open the client VLC first, then start stream server), so 
>I am guessing if there is some place in rtsp protocol to help the 
>client synchronize the audio and video. I checked the rtsp protocol, 
>it said In PLAY method, the Range header may help synchronization 
>the media from different source. I can not understand how this works.

No, A/V synchronization is ensured by using RTCP.  Please read the FAQ.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list