[Live-devel] Audio + Video streaming in sync using Live555

Ross Finlayson finlayson at live555.com
Tue Oct 16 06:01:22 PDT 2018

> we are using testOnDemandRTSPServer.cpp for the Live Video streaming.
> So, in the input I am giving H.264 Encoded fifo to the compile binary using this testOnDemandRTSPServer.cpp and I am getting RTSP URL for the Video streaming.
> This is working fine.
> Now,we want to add the Audio with Video in the Live streaming. For the Audio I have one AAC-LC Encoded fifo.
> But to stream Audio and Video fifo in time sync, I am not able to find any option in the testOnDemarRTSPServer.cpp file.
> It would be really helpful if you can provide any example/reference in which, I give the Audio fifo and video fifo as input and then I get the URL for the streaming.
> So, I can do the audio and video streaming smoothly.

Streaming audio+video is easy: Just call “addSubsession()” twice - once for the video source, another time for the audio source.  (So that your “ServerMediaSession” object contains two “ServerMediaSubsession” objects - one for the video, one for the audio.)

However, for audio/video synchronization to work properly, each source (video and audio) *must* generate proper “fPresentationTime” values for each frame, and these *must* be aligned with ‘wall clock’ time -  i.e., the same time that you’d get if you called “gettimeofday()”.

Ross Finlayson
Live Networks, Inc.

More information about the live-devel mailing list