Wowza Community

Direct communication with RTSP server

Hello,

I want to directly (using some custom piece of code) communicate with my RTSP server, to get session descriptors and start RTP streams.

Does wowza allow such level of customization?

My use case is that I have RTSP server deployed over NAT, and obviously, Wowza cannot directly connect to it from outside. I can only do port mapping for UDP, not TCP.

I am thinking about providing Wowza with the Socket already connected to the server, then it can use it to communicate with RTSP.

Another option, is that I handle RTSP part by my custom code, and provide Wowza with the session description (SDP) to start RTP.

So my constrain is that I cannot use TCP. Do you think one of the above scenarios possible? Any other suggestions?

Thanks,

Andrei

Andrei,

Take a look at IRTSPActionNotify:

https://www.wowza.com/docs/how-to-use-the-irtspactionnotify-interface-to-listen-for-rtsp-stream-events

Richard

Some encoders do RTSP announce, which is where you enter Wowza URL and application name in the encoder and it sends sdp file to Wowza. But your encoder is not one of those, and I’m not sure how to do what you are suggesting.

Richard

Andrei,

Yes, in this case the encoder starts by connecting to Wowza and sending the .sdp file over the wire, which Wowza then uses to initiate streaming as it would if the .sdp file were in the /content folder.

This is the basic guide for this kind of encoder:

https://www.wowza.com/docs/how-to-set-up-live-streaming-using-an-rtsp-rtp-based-encoder

Richard

For RTSP announce you have to connect to a specific Wowza application, that exists.

Richard

The generic instructions indicates only ip address + port, no protocol. And the application name is included with the stream name.

Host Address: [wowza-address]:1935

Stream Name: live/myStream.sdp

That is how you do it in Wirecast using the “RTSP/RTP based streaming” method. Take a look at the 2nd example in this old (1.7 forum) Wirecast guide

Richard

Hi Richard,

thanks for the pointer. However, if I understand the documentation correctly, this interface provides callbacks for RTSP actions for already created RTSP session.

Say, I have a RTSP server published on some port, which is not visible for Wowza. Once I start a stream (say defined by *.stream file, e.g. rtsp://192.168.1.10), Wowza will not be able to create an initial RTSP session.

Idea 1: I was thinking about implementing NAT traversal, and provide Wowza with the socket accepted by RTSP server.

Idea 2: I can publish SDP from the server to Wowza through UDP. The question is how to start RTP streaming from my custom handler. It is done through UDP in my case.

Here is some kind of flow:

  1. Wowza -> Server. Request SDP by doing UDP request.

  2. Server -> Wowza. Return SDP and start RTP session.

  3. Wowza -> ???

Thanks,

Andrei

Richard,

I am in full control of my encoder code, so I can implement RTSP Announce. Sounds very cool suggestion!

Does that also mean that Wowza listens for RTSP announcements and automatically starts re-streaming? (I need to support these streamers: cupertinostreaming, smoothstreaming, sanjosestreaming). Any pointers to documentation? Because at the moment I publish *.stream file just with RTSP and configure my Application.xml accordingly.

–andrei

Richard,

I made the following changes in VHost.xml: 554, 1935

Also created rtplive application, with the following in the Application.xml:

rtp-live

0.0.0.0

127.0.0.1

with no authentication:

none

none

If I create a TCP connection to Wowza

Socket socket = new Socket(“127.0.0.1”, 554);

and publish the RTSP announcement, I get

WARN server comment - Application folder ([install-location]/applications/defapp) is missing

It seems I am missing something trivial, but how should I publish my SDP to reach the rtplive application, which I defined in XML?

I am still a bit puzzled, RTSP is not HTTP, I can only connect to a certain IP address and a port. It is not clear, how I can specify the application.

Should I send RTSP announce by using HTTP POST to smth. like http://127.0.0.1:1935/rtplive ?

My Wowza server has the following IP:192.168.1.101

Encoder’s IP: 192.168.1.105

I am sending the following ANNOUNCE request to Wowza port 554:

ANNOUNCE rtsp://192.168.1.101:1935/rtplive/myStream.sdp RTSP/1.0

Cseq: 0

Content-Type: application/sdp

Session: 12345678

Content-Length: 299

v=0

o=- 1360014152814 1360014152814 IN IP4 192.168.1.105

s=Stream-0

i=N/A

c=IN IP4 192.168.1.101

t=0 0

a=recvonly

m=video 5006 RTP/AVP 96

b=RR:0

a=rtpmap:96 H264/90000

a=fmtp:96 packetization-mode=1;profile-level-id=42801e;sprop-parameter-sets=Z0KAHukBQHsg,aM4G4g==;

a=control:trackID=0

The first line in the request should indicate the actual Wowza application, right? So my RTSP announce is correct.

After the announcement is published, I see the following in the log:

NFO rtsp connect 938250587 -

INFO server comment - sortPackets[2]: sortBufferSize:500

INFO stream create - -

INFO rtsp announce 938250587 -

WARN server comment - RTPStream.idle[938250587:rtplive/definst:]: Close RTSP/RTP session. Session timeout: 90000

INFO stream unpublish - -

INFO server comment - MediaStreamMediaCasterPlay: close

INFO stream destroy - -

INFO rtsp disconnect 938250587 -

I did some experiments with Wirecast encoder, the log is the following after publishing (to the same Wowza application):

INFO rtsp connect 344217766 -

INFO server comment - sortPackets[1]: sortBufferSize:500

INFO stream create - -

INFO rtsp announce 344217766 -

INFO server comment - RTPUDPTransport.bind[rtplive/definst]: 0.0.0.0/0.0.0.0:6970

INFO server comment - RTPUDPTransport.bind[rtplive/definst]: 0.0.0.0/0.0.0.0:6971

INFO server comment - RTPUDPTransport.bind[rtplive/definst]: 0.0.0.0/0.0.0.0:6972

INFO server comment - RTPUDPTransport.bind[rtplive/definst]: 0.0.0.0/0.0.0.0:6973

INFO stream publish myStream.sdp -

INFO rtsp publish 344217766 -

INFO server comment - UDPTransport.firstPacket: bind:0.0.0.0/0.0.0.0:6970 msg:/192.168.1.101:57954

Do I need perhaps also send RTSP PLAY request?