# Restreaming video from IP camera programatically

**URL:** <https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [April 23, 2014, 9:27pm UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857 "2014-04-23T21:27:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sujil\_Chandrasekhara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@Sujil\_Chandrasekhara](https://community.wowza.com/u/Sujil_Chandrasekhara)\
**Post date:** [April 23, 2014, 9:27pm UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857/1 "2014-04-23T21:27:55Z")

</div>

Hi,

I am newbie here. What i am trying to do is to restream video from ip camera. I followed the steps mentioned in this url([https://www.wowza.com/docs/how-to-re-stream-video-from-an-ip-camera-rtsp-rtp-re-streaming](https://www.wowza.com/docs/how-to-re-stream-video-from-an-ip-camera-rtsp-rtp-re-streaming)) and as mentioned i am able to restream using .stream file.

What i am looking for is to programmatically do the same?

My scenario is like this, i have a web application which maps camera and its rtsp url to a database. Some thing like

cam1-\>rtsp://xx.xxx.xxxxx/xxx

cam2-\>rtsp://xx.xxx.xxxxx/xxx

and my client players use camera name(cam1, cam2) as an alias to actual stream. So what i want is, when a client request for a stream with alias name i want to fetch corresponding rtsp url from database and start the stream.

I followed the steps mentioned in this link([https://www.wowza.com/docs/how-to-use-the-imediastreamnamealiasprovider2-interface](https://www.wowza.com/docs/how-to-use-the-imediastreamnamealiasprovider2-interface)) overriding all resolve\*() methods returning rtsp url corresponding to alias name. But streams never got published and played.

Can you guys please guide me on how to do this?

Regards,

Sujil

---

<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 24, 2014, 1:13am UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857/2 "2014-04-24T01:13:41Z")

</div>

Sujil,

You also need to start the streams, either in StartUpStreams.xml, or you can use the [MediaCaster API](https://www.wowza.com/docs/how-to-mediacaster-api-to-start-native-rtp-and-mpeg-ts-streams) in the IMediaStreamNameAliasProvider2.resolvePlayAlias() methods.

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 24, 2014, 2:32pm UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857/3 "2014-04-24T14:32:32Z")

</div>

Sujil,

The MediaCaster type you want to use is “rtp”. You can also use “rtp-record” to also record the whole stream. Other MediaCaster types (but that are not relevant to you in this case) are shoutcast and liverepeater.

Richard

---

<div class="post-metadata">

**Author:** ![Sujil\_Chandrasekhara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@Sujil\_Chandrasekhara](https://community.wowza.com/u/Sujil_Chandrasekhara)\
**Post date:** [April 24, 2014, 7:59pm UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857/4 "2014-04-24T19:59:02Z")

</div>

Richard,

I tried to use MediaCaster API in IMediaStreamNameAliasProvider2.resolvePlayAlias() methods. While debugging i got below error

ERROR server comment - MediaCasterStreamMap.acquire: Can’t find MediaCaster definition for stream type: live

Can you please let me know how to resolve this error?

Regards,

Sujil C

---

<div class="post-metadata">

**Author:** ![Sujil\_Chandrasekhara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@Sujil\_Chandrasekhara](https://community.wowza.com/u/Sujil_Chandrasekhara)\
**Post date:** [April 25, 2014, 4:16pm UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857/5 "2014-04-25T16:16:08Z")

</div>

Changing MediaCaster type to rtp worked.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Sujil\_Chandrasekhara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@Sujil\_Chandrasekhara](https://community.wowza.com/u/Sujil_Chandrasekhara)\
**Post date:** [April 25, 2014, 4:50pm UTC](https://community.wowza.com/t/restreaming-video-from-ip-camera-programatically/42857/6 "2014-04-25T16:50:41Z")

</div>

Thanks Richard.

Changing MediaCasterType to rtp worked.
