# How to write rtsp url with parameters?

**URL:** <https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582>\
**Category:** Wowza Streaming Engine\
**Created:** [April 1, 2014, 5:12pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582 "2014-04-01T17:12:36Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 1, 2014, 5:12pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/1 "2014-04-01T17:12:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 1, 2014, 5:17pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/2 "2014-04-01T17:17:33Z")

</div>

Brian,

Change it to this:

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

```

You can process the querystring for an RTSP session in [onRTPSessionCreate](https://www.wowza.com/docs/how-to-control-access-to-rtsp-rtp-streams)

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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 2, 2014, 6:30pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/3 "2014-04-02T18:30:09Z")

</div>

Brian,

Try setting a lower streamTimeout. You can do this [in a .stream file](https://www.wowza.com/docs/how-to-specify-per-stream-settings-in-stream-files) like this:

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

```

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 8, 2014, 12:53am UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/4 "2014-04-08T00:53:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 14, 2014, 1:24am UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/5 "2014-04-14T01:24:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 14, 2014, 11:03am UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/6 "2014-04-14T11:03:06Z")

</div>

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

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 21, 2014, 6:39pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/7 "2014-04-21T18:39:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 2, 2014, 5:15pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/8 "2014-04-02T17:15:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 3, 2014, 6:04pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/9 "2014-04-03T18:04:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 9, 2014, 2:17pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/10 "2014-04-09T14:17:03Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 14, 2014, 3:17pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/11 "2014-04-14T15:17:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 21, 2014, 6:34pm UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/12 "2014-04-21T18:34:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Brian\_Chen](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@Brian\_Chen](https://community.wowza.com/u/Brian_Chen)\
**Post date:** [April 22, 2014, 10:12am UTC](https://community.wowza.com/t/how-to-write-rtsp-url-with-parameters/42582/13 "2014-04-22T10:12:14Z")

</div>

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