Wowza Community

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

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:

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

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

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

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

Richard

Yes, definitely.

Richard

You can use the built-in StreamManger in Wowza 2:

http://www.wowza.com/community/t/-/82

Richard

I have installed the mediacasterstreammanager module.

But when I try to connect via the mediacasterstreammanager client with:

Server: rtmp://server-ip/live --> connect

Stream: xxxx.sdp

Nothing shows up in the Active window and I get this error on the server:

INFO session connect-pending xx.xxx.xx.198 -

INFO session connect xx.xxx.xx.198 -

ERROR server comment - invoke(getMediaCasterStreamList): java.lang.NoSuchMethodError: com.wowza.wms.util.ModuleUtils.checkModulePassword(Lcom/wowza/wms/amf/AMFDataList;ILjava/lang/String;)Z: com.wowza.wms.plugin.mediacasterstreammanager.ModuleMediaCasterStreamManager.getMediaCasterStreamList(null:-1)

java.lang.NoSuchMethodError: com.wowza.wms.util.ModuleUtils.checkModulePassword(Lcom/wowza/wms/amf/AMFDataList;ILjava/lang/String;)Z

at com.wowza.wms.plugin.mediacasterstreammanager.ModuleMediaCasterStreamManager.getMediaCasterStreamList(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:86)

at com.wowza.wms.module.ModuleFunctions.invoke(ModuleFunctions.java:151)

at com.wowza.wms.request.RequestProcessFunctions.processFunctions(RequestProcessFunctions.java:107)

at com.wowza.wms.client.ClientWorker.processNextReq(ClientWorker.java:102)

at com.wowza.wms.request.RTMPRequestAdapter.service(RTMPRequestAdapter.java:350)

at com.wowza.wms.server.ServerHandler.serviceRequest(ServerHandler.java:479)

at com.wowza.wms.server.ServerHandler.handleMessageReceived(ServerHandler.java:270)

at com.wowza.wms.server.ServerHandler.messageReceived(ServerHandler.java:347)

at com.wowza.wms.server.ServerHandlerThreadedSession.run(ServerHandlerThreadedSession.java:108)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

ERROR server comment - invoke(startMediaCasterStream): java.lang.NoSuchMethodError: com.wowza.wms.util.ModuleUtils.checkModulePassword(Lcom/wowza/wms/amf/AMFDataList;ILjava/lang/String;)Z: com.wowza.wms.plugin.mediacasterstreammanager.ModuleMediaCasterStreamManager.startMediaCasterStream(null:-1)

java.lang.NoSuchMethodError: com.wowza.wms.util.ModuleUtils.checkModulePassword(Lcom/wowza/wms/amf/AMFDataList;ILjava/lang/String;)Z

at com.wowza.wms.plugin.mediacasterstreammanager.ModuleMediaCasterStreamManager.startMediaCasterStream(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:86)

at com.wowza.wms.module.ModuleFunctions.invoke(ModuleFunctions.java:151)

at com.wowza.wms.request.RequestProcessFunctions.processFunctions(RequestProcessFunctions.java:107)

at com.wowza.wms.client.ClientWorker.processNextReq(ClientWorker.java:102)

at com.wowza.wms.request.RTMPRequestAdapter.service(RTMPRequestAdapter.java:350)

at com.wowza.wms.server.ServerHandler.serviceRequest(ServerHandler.java:479)

at com.wowza.wms.server.ServerHandler.handleMessageReceived(ServerHandler.java:270)

at com.wowza.wms.server.ServerHandler.messageReceived(ServerHandler.java:347)

at com.wowza.wms.server.ServerHandlerThreadedSession.run(ServerHandlerThreadedSession.java:108)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

What is done wrong?

Thanks

… I thought that patch was already in place, but not…

Thanks.

When I set the Streamtype on rtp-live-record, for instance in the nativeRTP application, and I make a recording by connecting to the NativeRTP application, I am able to playback that recording, for instance in the nativeRTP of Fastplay application.

When I do a recording via the mediacasterstreammanager I am not able to playback the file in any of the WMS applications. Although when I download the file I can playback the file with VLC at good quality.

What is going different between these two ways of recording? And what can be done to get good recordings via the Mediacasterstreammanager which can be played back in standard WMS applications.

Thanks.

Has somebody a answer on this one?

Regards

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

Ok, that’s what I’ve done and it works great !

Since I use this module, I noticed record starts after a long time. Looking at logs, I see this :

INFO server comment 2009-02-16 12:05:30 33.155 UDPTransport.firstPacket: /XXX.XXX.XXX.XXX:XXXX

INFO server comment 2009-02-16 12:05:30 33.167 UDPTransport.firstPacket: /XXX.XXX.XXX.XXX:XXXX

WARN server comment 2009-02-16 12:05:38 41.165 Waiting for RTCP packet. See docs for (Application.xml: RTP/AVSyncMethod and RTP/MaxRTCPWaitTime).

WARN server comment 2009-02-16 12:05:39 41.274 Waiting for RTCP packet. See docs for (Application.xml: RTP/AVSyncMethod and RTP/MaxRTCPWaitTime).

WARN server comment 2009-02-16 12:05:42 45.173 RTCPHandler.isTimeSyncReady: Hit MaxRTCPWaitTime synchronizing on system clock.

Looking at Application.xml, StreamType is “live”, AVSyncMethod is “senderreport” and MaxRTCPWaitTime is “12000”.

So I guess nothing happens before a 12 seconds delay.

Do I need to change anything to make record start faster ?

Thank you.

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

As you know, I’m using VLC :wink:

Also, be sure you modify your command line to increase the key frame rate.

Could you explain me, even quickly, why do I need to do this ?

I certainly need to recreate my SDP file then …

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.

Ok. This is only for that purpose ? It won’t change anything else ? Cuepoints, etc … ?

For now, I’ve switched to “rtptimecode” and it’s much better now so I don’t want to change anything to encoder part if it’s only to start recording 80 milliseconds earlier …

@Charlie : I just realized “duration” property in recorded FLV metadata is sometimes equal to 0.

I don’t know exactly when it happens but the file is 44 minutes long. flvtool2 says :


/usr/local/WowzaMediaServerPro-1.6.0/content/XXXXXXXXXXXXXX.flv:

rtpsessioninfo:

protocolversion: 0

name: XXXXX

timing: 0 0

attributes:

tool: vlc 0.8.6h

origin: - 10737062000 2 IN IP4 127.0.0.1

connectiondata: IN IP4 XX.XXX.XXX.XXX

videocodecid: avc1

audiosamplerate: 44100

creationdate: mer. mars 25 10:00:37

trackinfo:

sampledescription:

sampletype: mpeg4-generic

language: eng

timescale: 44100

sampledescription:

sampletype: H264

language: eng

timescale: 90000

height: 0

duration: 0

audiocodecid: mp4a

width: 0

audiochannels: 0

Could you take a look to this please ?

FlowPlayer can find the correct duration, I don’t know how because in my Flex application, duration caught by onMetaData is 0.

The code I’m using is similar to :

this.nsClient=new Object();

this.nsClient.onCuePoint=this.ns_onCuePoint;

this.nsClient.onMetaData=this.ns_onMetaData;

this.ns.client=this.nsClient;

Thank you.

Ok Charlie, I’ll pay attention to this carefully next time …

Java code is :

boolean success = mediaCasterStreamManager.stopStream(streamNameOn);
if (success == true)
{
  // rename SDP
  // move FLV
}

So it seems stopStream() has not ended when I move FLV …

You will need to use the IMediaStreamActionNotify2 interface and add a listener to get notification of the onUnPublish event.

Great ! Now I must find out how to code this and where I could use this code :wink:

Charlie, could you post sample code on how to implement IMediaStreamActionNotify2/onUnPublish ?

I just don’t know where to start and where add this in my current module ?

Thanks a lot !