# MediaCasterStreamManager controls start/stop/record of RTP, MPEG-TS and SHOUTcast

**URL:** <https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54>\
**Category:** Wowza Streaming Engine\
**Created:** [January 26, 2009, 12:48pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54 "2009-01-26T12:48:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [January 26, 2009, 12:48pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/1 "2009-01-26T12:48:58Z")

</div>

This package provides a Flash tool to interface with the MediaCasterStreamManager API. This to tool is used to start and stop the publishing of non-pushed based encoder streams such as **Native RTP** , **MPEG-TS** and **SHOUTcast**. It provides greater control over the publishing and recording process when using these encoder technologies. This tool is designed to work with the **live** , **live-lowlatency** and **liverepeater-origin** stream types rather than the MediaCaster stream types (**rtp-live[-\*]** and **shoutcast[-\*]**). The MediaCasterStreamManager API can also be accessed using the JMX/JConsole interface to the server. The MediaCasterStreamManager interface is available in JConsole in the MBean tab in the application folder of the application you wish to control.

[MediaCasterStreamManager.zip](https://www.wowza.com/downloads/forums/mediacasterstreammanager/MediaCasterStreamManager.zip)

Note: [Wowza Pro 1.6.0-patch17 or greater required](https://www.wowza.com/devbuild.html)

Enjoy,

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 14, 2009, 4:55am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/2 "2009-02-14T04:55:40Z")

</div>

You will need to rename the file after it has completed being written.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 16, 2009, 5:20am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/3 "2009-02-16T05:20:11Z")

</div>

Try changing AVSyncMethod to one of the other two valid values. It sounds like the encoder you are using does not generate RTCP packets.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 16, 2009, 5:46am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/4 "2009-02-16T05:46:12Z")

</div>

Same answer. I know VLC doesn’t generate RTCP packets. See which of the other two values gives you better results. Also, be sure you modify your command line to increase the key frame rate.

Change the encoder part:

```auto
from:
venc=x264,vcodec=x264
to:
venc=x264{keyint=2},vcodec=x264

```

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 16, 2009, 7:38am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/5 "2009-02-16T07:38:23Z")

</div>

This will increase the frequency at which the encoder generates key frames. It will improve stream startup time since the stream needs a key frame to start. Yes, you will most likely need to regenerate the SDP file.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 17, 2009, 12:06pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/6 "2009-02-17T12:06:45Z")

</div>

Upgrade to the most recent patch (patch21) from here:

[https://www.wowza.com/devbuild.html](https://www.wowza.com/devbuild.html)

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 27, 2009, 9:33am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/7 "2009-02-27T09:33:53Z")

</div>

Someone else reported a similar issue and it was due to the fact that Wowza Pro does not send RTCP RR packets. See if there is a way to configure Darwin so that it is not depending on these packets. At this time we do not have plans to implement RTCP RR packets.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [April 8, 2009, 4:17am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/8 "2009-04-08T04:17:27Z")

</div>

You are probably moving or copying the file before it has completely been written. The file is done being written the the unpublish event is throw/logged. Before that the duration written to the file header is zero.

Wowza Pro does have a way if the duration is incorrect in the header to derive it by looking at the last packet in the file.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [April 8, 2009, 5:57am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/9 "2009-04-08T05:57:31Z")

</div>

I believe that is correct. I don’t think the stream has been written after stopStream. I believe this operation is asynchronous. You will need to use the IMediaStreamActionNotify2 interface and add a listener to get notification of the onUnPublish event.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [June 27, 2009, 4:04am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/10 "2009-06-27T04:04:40Z")

</div>

Be sure that each time you start the stream you select rtp-record from the list of media caster stream types in the MediaCasterStreamManager.

Charlie

---

<div class="post-metadata">

**Author:** ![Sebastien\_Faure](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@Sebastien\_Faure](https://community.wowza.com/u/Sebastien_Faure)\
**Post date:** [February 14, 2009, 12:22pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/11 "2009-02-14T12:22:37Z")

</div>

Thank you Charlie, as I told you before, it works great.

But now I would like to know if there’s a way to control the recorded file name.

For now, if stream name is “stream.sdp”, recorded file name is always “stream.sdp.flv”.

To avoid erasing previous recorded files, I would like to set name to “streamXXXXXXXXXXXX.flv” where XXXXXXXXXXXX is current date/time (YYYYMMDDHHMM).

What do I need to change in ModuleMediaCasterStreamManager.java to do this ? startStream() method parameters ?

Thx.

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 25, 2009, 5:22am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/12 "2009-02-25T05:22:50Z")

</div>

If you recording using the mediacasterstreammanager the file is not properly closed until the mediacasterstreammanager is used to stop the stream. If you grab the file before the stream is stopped then the moov atom will not be written properly.

If this is not the problem then please send me the errant file and I will have a look ([charlie@wowza.com](mailto:charlie@wowza.com)).

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 27, 2009, 8:21am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/13 "2009-02-27T08:21:54Z")

</div>

Please describe in detail how you are connecting to Darwin. Is it through RTSP or native RTP. Are you seeing any log statements when the stream stops. Be sure to install the most recent patch. Some of the RTSP re-streaming code has been improved ([https://www.wowza.com/devbuild.html](https://www.wowza.com/devbuild.html)).

I need a lot more detail to help.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [July 3, 2009, 1:42pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/14 "2009-07-03T13:42:36Z")

</div>

I need to think about this more. It is a clear need. The source code for the MediaCasterStreamManager is included in the package. So you can fashion a different solution to fit your needs. I will continue to think about how to make this a more straight forward operation.

Charlie

---

<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:** [March 2, 2009, 11:01am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/15 "2009-03-02T11:01:39Z")

</div>

The easiest way is change the StreamType to “rtp-live-record”

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, 2009, 10:19am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/16 "2009-04-14T10:19:36Z")

</div>

Try this:

```auto
package
import com.wowza.wms.amf.AMFDataItem;
import com.wowza.wms.amf.AMFDataObj;
import com.wowza.wms.amf.AMFPacket;
import com.wowza.wms.application.WMSProperties;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.IMediaStream;
import com.wowza.wms.stream.IMediaStreamActionNotify;
import com.wowza.wms.stream.IMediaStreamActionNotify2;
public class MediaStreamActionNotify2Example extends ModuleBase {
	
	public void onStreamCreate(IMediaStream stream) {
		getLogger().info("onStreamCreate by: " + stream.getClientId());
		IMediaStreamActionNotify actionNotify = new StreamListener();
		
		WMSProperties props = stream.getProperties();
		synchronized(props)
		{
			props.put("streamActionNotifier", actionNotify);
		}
		stream.addClientListener(actionNotify);
	}
	public void onStreamDestroy(IMediaStream stream) {
		getLogger().info("onStreamDestroy by: " + stream.getClientId());
		
		IMediaStreamActionNotify actionNotify = null;
		WMSProperties props = stream.getProperties();
		synchronized(props)
		{
			actionNotify = (IMediaStreamActionNotify)stream.getProperties().get("streamActionNotifier");
		}
		if (actionNotify != null)
		{
			stream.removeClientListener(actionNotify);
			getLogger().info("removeClientListener: "+stream.getSrc());
		}
	}
	
	class StreamListener implements IMediaStreamActionNotify2 
	{
		public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset) 
		{
			
		}
		public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket) 
		{
			
		}
		
		public void onPauseRaw(IMediaStream stream, boolean isPause, double location) 
		{
			
		}
		public void onSeek(IMediaStream stream, double location)
		{
			getLogger().info("onSeek");
		}
		
		public void onStop(IMediaStream stream)
		{
			getLogger().info("onStop By: " + stream.getClientId());
		}
		
		public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
		{
			getLogger().info("onUN Publish");
		}
		public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
		{
			getLogger().info("onPublish");					
		}
		public void onPause(IMediaStream stream, boolean isPause, double location)
		{
			getLogger().info("onPause");
		}
	}
}

```

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, 2009, 11:00am UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/17 "2009-04-14T11:00:45Z")

</div>

I don’t have experience with that package yet, but I took a look at the included source, and there is a stopMediaCasterStream method that returns results to the calling client. You might be able to use that on the client.

In AS3 (untested) I think it will look something like this:

```auto
netconnection.call("stopMediaCasterStream", new Responder(mediacasterResponse));
private function mediacasterResponse(response:Object):void
{
 if (response.description.indexOf("Stream stopped:")>-1)
  {
    trace("stream ready to move");
  }
}

```

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, 2009, 1:34pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/18 "2009-04-14T13:34:05Z")

</div>

I think you are right. So just copy and paste 3 things from the Java Example I sent into ModuleMediaCasterStreamManager.java

public void onStreamCreate(IMediaStream stream) {

…

}

public void onStreamDestroy(IMediaStream stream) {

…

}

class StreamListener implements IMediaStreamActionNotify2

…

}

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:** [November 12, 2009, 8:30pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/19 "2009-11-12T20:30:56Z")

</div>

This won’t work:

mystream=rtmp://xxx.xx.xx.xx/live/_definst_/livestream

Because you are using a rtmp url for stream name.

> alias = stream name

This will work:

mystream=livestream

But for that to work you have to be sending an actual live stream named “livestream” with an encoder such as Wirecast that will push a live stream over rtmp to Wowza. Then in a player you can play a stream “mystream” and the alias system will kick in and transform mystream to livestream, if that’s useful.

With rtsp streams, where the stream name itself is a url like rtsp://ipcamera-ip:554, and you can use an alias to simplify:

mystream= rtsp://ipcamera-ip:554

In this case the rtsp url is a stream name. So “mystream” will be expanded by the alias system to the rtsp url.

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:** [November 13, 2009, 1:34pm UTC](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54/20 "2009-11-13T13:34:06Z")

</div>

Great!, thanks for the update. glad it’s working.

Richard

[Next page](https://community.wowza.com/t/mediacasterstreammanager-controls-start-stop-record-of-rtp-mpeg-ts-and-shoutcast/54.md?page=2)
