1

I am trying to implement a RTSP broadcaster for mac. I am able to broadcast the audio and video independently but when i start to broadcast them simultaneously i hear only audio or video at a single time. If Audio plays than video doesn't shows and if Video plays there is no Audio.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dinesh
  • 929
  • 7
  • 25
  • What RTSP client are you using? You need to implement RTCP SRs at the sender that contain RTP to NTP timestamp mappings which are required to synchronise the streams to the same clock. – Ralf Aug 21 '15 at 15:23
  • Thanks Ralf. I am using Wowza (developer trial version) as streaming engine.. I can't understand What RTP to NTP timestamp mapping means? I am already sending the same NTP to both audio and video RTCP.. But I have no idea where NTP time used in RTP packets.. Can you please eloborate more if possible.. – Dinesh Aug 24 '15 at 22:25
  • 1
    RTP timestamps start at a *random* 32-bit base number which will be different for audio and video. The RTCP SR contains an NTP and RTP timestamp telling you what NTP timestamp is associated with an RTP timestamp. Thus, only after you have received an SR in each RTP session, can you synchronise the audio and video timestamps with one another. I recommend you get hold of the Colin Perkins RTP book which explains this in great detail. – Ralf Aug 25 '15 at 07:11
  • Hi Ralf, I am able to stream both audio and video simultaneously. earlier i was using the same ntp time for both audio & video.. thanks But there is still there are some issues.. Sometimes Audio plays but video doesn't.. Is there something i need to do solve this issue.. also Is there anything special needs to be done to sync audio and video properly? – Dinesh Aug 25 '15 at 09:41
  • You can use the testRTSPClient tool from live555.com to check that your timestamps are correct. It prints out the presentation times of arriving audio and video packets (you might have to compile it with debug info enabled to see that info, can't remember). – Ralf Aug 25 '15 at 14:32
  • Can this tool works with wowza ? or i need to install the Live555 streaming server for that.. is there any sort of tutorial available for same? – Dinesh Aug 26 '15 at 04:48
  • It is a standard conformant RTSP client: basically you just want to make sure that the presentation times streamed from the server are correct. What do you mean by "using Wowza as streaming engine". Are you using a stock Wowza server? Or libraries to implement your own server? Or client? And if not client, what client are you using? – Ralf Aug 26 '15 at 09:29
  • I am new to RTSP so testing my code with a trial version of Wowza client.(not sure about stock) for timestamp part, For video i am increasing the timestamp with multiples of 90000.. and for audio the timestamp is increasing by multiples of (sample size*90000)/sampleRate.. The source of audio and video are both different in my case.. video packets are got from files and audio packets are delivered as buffers to me directly which i am directly broadcasting to RTSP server. – Dinesh Aug 26 '15 at 10:55
  • Ok, in that case I would use the testRTSPClient tool, which will give you an output such as http://lists.live555.com/pipermail/live-devel/2013-April/016862.html In the link you can see that presentation times of audio and video sessions are ordered and in the same range. This will tell you if the problem is in the client (less likely as others would have had this issue) or your server implementation (more likely). – Ralf Aug 26 '15 at 12:53
  • Ok Ralf, I will try to check this tomorrow.. – Dinesh Aug 26 '15 at 13:49

1 Answers1

1

There was some problem in apple AVcapture session as it was delaying the production of packets after some time. I have to create a seprate avcapturesession for mic and it solves my issue. Thanks Ralf for all your support..

Dinesh
  • 929
  • 7
  • 25