# Wowza MP4 Append and file mover addon

**URL:** <https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943>\
**Category:** Wowza Streaming Engine\
**Created:** [January 5, 2012, 10:57am UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943 "2012-01-05T10:57:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 5, 2012, 10:57am UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/1 "2012-01-05T10:57:28Z")

</div>

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

---

<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:** [January 5, 2012, 8:31pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/2 "2012-01-05T20:31:14Z")

</div>

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](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

---

<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:** [January 10, 2012, 8:28pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/3 "2012-01-10T20:28:34Z")

</div>

Ken,

What method are you using to control append?

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

```auto
<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](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](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](https://www.wowza.com/docs/how-to-use-imediawriteractionnotify-to-programmatically-move-and-rename-recordings-of-live-streams)

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:** [January 12, 2012, 10:41pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/4 "2012-01-12T22:41:14Z")

</div>

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

```auto
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

---

<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:** [January 13, 2012, 4:30pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/5 "2012-01-13T16:30:20Z")

</div>

Try it like this.

server-side:

```auto
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:

```auto
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

---

<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:** [January 13, 2012, 4:32pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/6 "2012-01-13T16:32:35Z")

</div>

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](https://www.wowza.com/docs/how-to-parse-post-or-get-variables-in-an-http-provider)

Richard

---

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 5, 2012, 4:39pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/7 "2012-01-05T16:39:12Z")

</div>

Thanks, i’ll look into that class.

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

Thanks,

- Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 10, 2012, 2:21pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/8 "2012-01-10T14:21:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 10, 2012, 3:23pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/9 "2012-01-10T15:23:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 12, 2012, 5:29pm UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/10 "2012-01-12T17:29:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 13, 2012, 10:32am UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/11 "2012-01-13T10:32:35Z")

</div>

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 ).

---

<div class="post-metadata">

**Author:** ![Kenneth\_Koch](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@Kenneth\_Koch](https://community.wowza.com/u/Kenneth_Koch)\
**Post date:** [January 17, 2012, 11:27am UTC](https://community.wowza.com/t/wowza-mp4-append-and-file-mover-addon/37943/12 "2012-01-17T11:27:12Z")

</div>

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!
