Wowza Community

On the fly starting a rtsp stream when a client connects

Hi

We are looking for APIs where we could start an rtsp stream(url could change dynamically based on the client) from the source based on the client connected and stream that source to the client.

Another question is that is there a way to control the type of transcode to which the client can be connected.

Thanks,

Srikanth V

You could use the MediaCaster API to start/stop the stream during a playback request via the IMediaStreamNameAliasProvider2-resolvePlayAlias event. However, you may run into timing issues if the source takes too long to respond.

Yes, IMediaStreamNameAliasProvider2 is what you will need to do that. If you have RTMP and/or RTSP clients only you can use the resolvePlayAlias() handler which will run when a stream is played in a RTMP client. In that case use StreamType “rtp-live”. However if you have HTTP clients like iOS devices playing HLS (cupertino) streams, you should use resolveStreamAlias which runs when you start the stream in StreamManager or /conf/StartUpStreams.xml. Use StreamType “live” in this case.

Richard

First, /conf/StartUpStreams.xml runs when Wowza starts, any MediaCaster streams (from for example IP cameras and mpeg-ts encoders) will start when Wowza starts, rather than when a client connects.

If you are only using Flash RTMP clients or RTSP clients, and the source is a MediaCaster stream (IP camera, mpeg-ts encoder), then all you have to do is the first step: Change the Application.xml /StreamType to “rtp-live”. You do not need steps 2, 3 and 4.

But if you are streaming to HTTP clients, you should make the StreamType “live” and use /conf/StartUpStreams.xml to start the stream, because Wowza needs some lead time to start packetizing for HTTP clients.

Richard

Hello,

The playback of SMIL descriptor files is not supported over RTSP

Zoran

You can use the Transcoder addon to create different bitrate renditions of a live input stream, and you can play back each of those renditions individually over RTSP, but adaptive streaming over RTSP isn’t supported by Wowza.

If you want to switch from one transcoded stream to another, you will need to do it on the client side.

Zoran

Hi,

You can take a look at the How to control which streams get transcoded using server-side API article.

This will only show how to programatically control which stream is transcoded and which isn’t.

There is no API to stop or start the transcoding process for a certain stream. The only way to do that is to stop/start that particular stream.

Zoran

Also, I should mention, that if your clients are rtmp and/or rtsp you would just need to set your stream type to “rtp-live” and that would be all. You wouldn’t need to use the above method.

Also, I should mention, that if your clients are rtmp and/or rtsp you would just need to set your stream type to “rtp-live” and that would be all. You wouldn’t need to use the above method.

Hi Matt,

Thanks for the response. On the fly I meant the rtsp url has to be fetched from our database/our from an external source based on some look up.

So We can use IMediaStreamNameAliasProvider2 for the same if I understand correctly please correct me.

The second approach(setting the stream type to rtp-live) is more like a static configuration right as the url needs to be resolved at run time?

Step 1:Edit Application.xml present in C:\Program Files (x86)\Wowza Media Systems\Wowza Media Server 3.6.3\conf[Application folder] and follow the steps

->under tag,change to rtp-live/live from default for live streaming.

->changecupertinostreamingpacketizer,smoothstreamingpacketizer,sanjosestreamingpacketizer<\LiveStreamPacketizer>

Step2:create Wowza Media Server Project in wowza IDE,extend IMediaStreamNameAliasProvider2 interface by sampleClass,Override resolveplayalias and streamalias methods,build the project and paste sampleclass.jar in C:\Program Files (x86)\Wowza Media Systems\Wowza Media Server 3.6.3\lib location.

Step3:Add the following module last in the list in /conf/[applicaion folder]/Application.xml:

sampleclass

ModuleStreamNameAlias

com.wowza.wms.example.module.sampleclass

Step4:Publish stream using Stream Manager/startupstreams.xml.

Step:Use the below mentioned URL for playback at client side

rtsp://[wowza-ip address]:1935/[app-name]/channel1 or use any strings for stream name instead of .stream file name.

Hi

I’m creating multiple transcode profile in my application using “Transcode.xml”,In log statistics file i’m getting those profiles too.The problem is how to switch between different profiles?This is my playback URL “rtsp://[wowza-IP address]:1935/[app-name]/[any string]_360p” or “rtsp://[wowza-IP address]:1935/[app-name]/[any string]_160p”.if i use smil file, I’m getting invalid URL error while playing in vlc media player.Please suggest some alternatives for transcoder profiles using rtsp protocol.

Hello,

The playback of SMIL descriptor files is not supported over RTSP

Zoran

Hi Zoran,

Thanks for your response.1 more question i have,Can you please suggest some other alternatives for transcoding and playback using rtsp?

You can use the Transcoder addon to create different bitrate renditions of a live input stream, and you can play back each of those renditions individually over RTSP, but adaptive streaming over RTSP isn’t supported by Wowza.

If you want to switch from one transcoded stream to another, you will need to do it on the client side.

Zoran

Hi Zoran,

can you please suggest me any API to start and stop the transcoding Dynamically or on the fly?