Wowza Community

How to write rtsp url with parameters?

Hi:

I can play live stream using vlc with url rtmp://localhost:1935/live?param=data&param1=data1/myStream. But I can’t play after changing rtmp to rtsp. Did I place the parameters in a wrong position or something else? Could anyone tell me how to use rtsp with parameters to play live stream. Thanks a lot.

Best Regards

Brian

Brian,

Change it to this:

rtsp://localhost:1935/live/myStream?param=data&param1=data1

You can process the querystring for an RTSP session in onRTPSessionCreate

The way you have the querystring arranged in the RTMP url is correct because it is parameters of the connect part of the RTMP url, and can be processed in onConnect handler. RTMP clients make a NetConnection, then create a NetStream, using the stream name at end of your URL. So two stages for RTMP. RTSP session do not work the same, there is just one stage. For HTTP playback URLS also, put the querystring at the end.

Richard

Brian,

Try setting a lower streamTimeout. You can do this in a .stream file like this:

{
    uri:"udp://192.168.1.100:10000",
    streamTimeout:5000,
 }

Richard

Brian,

I’m not sure how/what you are seeing. I started a stream from an IP camera, and played it back in two RTMP clients and two RTSP clients at the same time, then stopped them all one after the other and got immediate disconnects for each one.

Richard

You might take a look at the ReadBufferSize and SendBufferSize settings in /conf/VHost.xml, and the in-line comments. And it would probably help to decrease the bitrate of the stream or provide multiple renditions in an ABR stream

Richard

No, there is not a way to clear the server-side buffer.

Richard

Yes, but only one will work, and by default it is the 2nd stream wins. But you can switch this behavior in the Manager Application > Incoming Security page, select “Reject a second stream with the same name that’s published to this application”. Then any stream with the same name as existing live stream will be rejected.

Richard

Hi Richard,

It worked after I changed the url and modified the code as you said. Thanks again. But there’s another problem here. When the vlc player start to play live stream. A thread is started in onRTPSessionCreate to publish rtmp live stream to wowza, then the vlc can play the live stream well. But when I stop the player, it seems onRTPSessionDestroy is not entered instantaneously, it takes quite a while for the program to go into onRTPSessionDestroy. Do you know how to make onRTPSessionDestroy is entered right after the player is stopped? Many thanks.

Brian

Hi Richard,

Sorry it doesn’t work. It seems to have little to do with stream timeout time because the stream creation is fast. But when the player is stopped, the IP camera which is supposed to stop publishing the live stream is still running. Same thing happens to rtmp live stream. If there’s only one client watching the rtmp live stream, the onDisconnect will be called right after the client is stopped. But if there’re two clients watching the same stream, the onDisconnect won’t be called until tens of seconds has passed. Do you have any idea of what causes this? Thank you.

Brian

Hi Richard,

Maybe it’s the media player’s problem. Thanks for your support. And I have another problem recently, so I hope that you could help me.

I notice that the live stream delay is short at the beginning of the live stream, like 7 seconds. But after 10 or 20 minutes the delay becomes longer, like 20 seconds or so. Does this have something to do with the buffersize used in wowza server? How to reduce the delay time? Could you tell me the BufferSize in VHost.xml means bytes or kilobytes? How to wirte some codes to know how many data has been stored in buffer and the spare size of the buffer? Thanks very much!

Thank you. Is there any method I could call to clear the buffer?

Thanks for your reply. And I have another question. Can I have two different publishers publish the same stream? Each publisher has a different client.

Thanks, it really helps a lot. It seems this place is becoming my own area for me to ask questions.:slight_smile: