Wowza Community

Wowza MP4 Append and file mover addon

Hello,

I am working on an application on and ec2 instance of wowza 3. I have a live stream which can be paused/resumed while its running. I then need those to be compiled into one mp4 video and copied to a folder on an s3 bucket.

Currently im having the following issues:

  1. When i use flv as the format, the append mode works fine and appends the video. When i switch to mp4 (by using the mp4: prefix on the stream name) it no longer appends, but now it versions the files.

  2. I tried using the file mover module, but it copies the files too soon, once the video is paused it copies the file over, and as far as i could tell doesnt support any appending once the file is moved.

I guess what i would need is a way to append mp4s and get the appended file when it is complete moved over to to the s3 bucket.

Thanks in advance,

Ken

Ken,

The built-in file mover is not going to work in this case. You will need more control, take a look at IMediaWriterActionNotify

https://www.wowza.com/docs/how-to-use-imediawriteractionnotify-to-programmatically-move-and-rename-recordings-of-live-streams

What version of Wowza and the LiveStreamRecord package are you using?

Richard

Ken,

What method are you using to control append?

Try adding these Property settings to the /conf/[app-name]/Application.xml /Streams /Properties list

<Property>
	<Name>versionFile</Name>
	<Value>false</Value>
	<Type>Boolean</Type>
</Property>
<Property>
	<Name>appendFile</Name>
	<Value>true</Value>
	<Type>Boolean</Type>
</Property>

Then mount s3 bucket with s3fs

https://www.wowza.com/docs/how-to-use-the-fuse-based-file-system-backed-by-amazon-s3

Then to move, two options:

  • Built-in, configurable:

https://www.wowza.com/docs/how-to-move-recordings-from-live-streams

  • API:

https://www.wowza.com/docs/how-to-use-imediawriteractionnotify-to-programmatically-move-and-rename-recordings-of-live-streams

Richard

In a Wowza Module you can use IApplicationInstance.getPublishStreamNames(), something like:

MediaStreamMap streams = appInstance.getStreams();
List<String> streamNames = streams.getPublishStreamNames();
Iterator<String> iter = streamNames.iterator();
while(iter.hasNext())
{
	String streamName = iter.next();
	List<IMediaStream> listeners = appInstance.getPlayStreamsByName(streamName);
	if (listeners == null)
		continue;
	//System.out.println("streamName: "+listeners.size()+":"+streamName);
	IMediaStream stream = streams.getStream(streamName);
	if (stream == null)
		continue;
}

Richard

Try it like this.

server-side:

public void isStreamLive(IClient client, RequestFunction function,
		AMFDataList params) {
	
	Boolean streamExists = false; 
	String streamName = getParamString(params, PARAM1);
	MediaStreamMap streams = client.getAppInstance().getStreams();
	IMediaStream stream = streams.getStream(streamName);
	
	if (stream != null)
		streamExists = true;
	
	sendResult(client, params, streamExists);
}

Flash client-side:

var clientObj:Object = new Object();
clientObj.isStreamLive(streamExists:Boolean):void
{
trace(streamExists);
});
netconnection.client = clientObj;
netconnection.connect("rtmp://[wowza-address]:1935/[app-name]");
// elsewhere
netconnection.call("isStreamLive",null,"myStream");

Richard

oh, avoiding Flash… you can do same in HTTPProvider.

https://www.wowza.com/docs/how-to-parse-post-or-get-variables-in-an-http-provider

Richard

Thanks, i’ll look into that class.

I’m using version 3 of wowza and live stream recorder.

Thanks,

  • Ken

So what i was thinking was i could make a custom rpc which i could call when they video is finished recording (not just paused) that could move the file to s3.

My only other problem is that when using mp4: the files are not appending. If i remove the mp4: they append, but they are flv files i need mp4s.

Is mp4 appending not supported?

Thanks,

Ken

Scratch that it seems to be working now (appending the video at least). I’ll continue to play around with the wowza IDE, thanks!

  • Ken

Ok i think i have my custom module working pretty well, just one more little problem.

From the webpage which is streaming the video (recieving it from the live feed) When the broadcaster pauses the feed (essentially closes the connection) the video player crashes and says that it is unable to connect.

My question is, is there a way through either php or javascript to check if a stream is available or not?

Thanks,

Ken

Ok thats perfect.

I know this probably isn’t your specialty but any idea how i might get that information in javascript or php? That would be ideal, I just haven’t been able to find any examples for how to call these functions in my module from the actual site ( aside from using flash, which im looking to avoid ).

Richard,

Thank you for all your help, I’m left with one small question. Is there any way to call these RPCs without using flash (using php or javascript)? I have some call that need to be made from a web interface but dont want to have to incorporate a bunch of flash if i can just use JS to call them.

Thanks,

Ken

EDIT: scratch that, jsut saw your post above, ill check it out. Thanks!