Live-record mp4 format?

I’m sending h.264/AAC streams to Wowza and am using live-record as an app type, as I want all streams recorded. They are written as .flv’s which take time to re-encode for VOD - can I have them record as .mp4 containers, instead? I know there is an Ondemand recording module that has that option but I specifically want to record every stream sent.

If you add “mp4:” prefix to stream name in the encoder (or StreamManager in the case of MediaCaster streams), then Wowza records to mp4 container.

Stream name “mp4:myStream” will record to myStream.mp4

Richard

Please keep your posts G-rated on Wowza forum.

Thanks,

Richard

Yes, and there is an example of doing that in readme.html file in the package.

Richard

Try in publish command:

https://www.wowza.com/docs/how-to-override-publish-to-remap-a-stream-name

Richard

Make sure the stream actually contains h.264 video and AAC or MP3 audio.

Richard

This worked for Moresheth:

Not sure what else to suggest.

Richard

You might be able to make something with these two interfaces:

You can get codec info with IMediaStreamActionNotify3:

https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info

And control which streams are transcoded:

https://www.wowza.com/docs/how-to-control-which-streams-get-transcoded-using-server-side-api

It would be a little complicated, and if you need to be able to use different templates depending on circumstances, that might not work as expected. These kind of properties can be changed but usually affect the whole application not just the session.

Richard

yeah it would be much better to just flag this in a configuration file. I dont even know which application to change with this recordType, i mean i use the preset “live-record”, i stil have this problem, and using mp4: prefix up other 3rd party moduels i use for key authentication.

that stil does change the streamname to mp4: , isnt there any way todo this without altering the streamname? having mp4: in front of my streams does stil break my 3rd party plugins and cdn configurations.

Please make it configurable in a config parameter switch in one of the next releases or wowza 3 :confused:

that is the case, but that doesnt help me that internaly wowza will add mp4: for the stream handling and this breaks my authentication plugin as example :frowning:

I think I read this in another post but thought it only applied to the on-demand recorder addon.

Is there a config file where I can change this too? I think in the other post it said I could change it in a config file, it would still have an .flv extension but I just would have to rename it. That’s a much better option for me; if I change the stream name I have to change a ton of other stuff for my player, CDN, etc.

Edit: Oh, I see, it doesn’t actually change the client connect string at all, looks like. The “mp4:” part is only used by Wowza and is stripped for the client connections, is that more or less correct? It’s not something that will get passed up to my CDN, etc? I can connect to it without that part in the connection string, it appears.

Still would be nice to be able to just set it and forget it in the config but I can work either way for now.

Hi there.

Is it possible to set an stream name alias to have it always prepend the “mp4:”?

Alternately, if it has to be compiled into a module for renaming the stream, do you know at which event is the proper time to rename it? Like, is it possible to add “mp4:” to the name to the stream in the onPublish StreamListener event?

I see the section you are talking about, but it is in the Play Aliases, not the Stream Aliases. I may be misunderstanding what those two are for, but whenever I try to add the mp4: prefix, the server still saves the inbound streamed data as an .flv file. I was trying to use an alias to have it save as an .mp4 file. This is what I have in both the aliasmap.play.txt and aliasmap.stream.txt:

*=mp4:${Stream.Name}

I see in the server logs that requests from the video player are being run through this alias, but I don’t see anything about the inbound stream from the Media Encoder being checked, and it’s still saving as an .flv file.

Thanks for answering so quickly.

woot!

That worked, thank you.

For those needing to do the same, here is the code I used for the module:

package com.MYCOMPANY.module;
import com.wowza.wms.application.*;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.rtp.model.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
public class PrependMp4 extends ModuleBase
{
	public void publish(IClient client, RequestFunction function, AMFDataList params)
	{
		String streamName = getParamString(params, PARAM1);
		params.set(PARAM1, "mp4:"+streamName);
		invokePrevious(client, function, params);
	}
	public void releaseStream(IClient client, RequestFunction function, AMFDataList params)
	{
		String streamName = getParamString(params, PARAM1);
		params.set(PARAM1, "mp4:"+streamName);
		invokePrevious(client, function, params);		
	}
}

I copied the compiled jar file to the lib folder on the server, and then inside the Application.xml for the “live” application, I added this to the node:

<Module>
    <Name>PrependMp4</Name>
    <Description>Forces saving in mp4 format.</Description>
    <Class>com.MYCOMPANY.module.PrependMp4</Class>
</Module>

I restarted the server, and now it saves .mp4 files by default.

Dear Moresheth,

Can you upload your jar file here?

I am new in wowza and i am not familiar with java, i was tried your code for recording stream in .mp4, but unable to success, so i request to you please share your file…

Regards,

You can download the Wowza IDE and user guide from here:

Wowza IDE

This will walk you through the steps to creating modules in Wowza.

Salvadore

Hi Richard,

What if it is a third party encoder and I don’t know if it contains h.264 or AAC? Can I use a transcoder first before recording? … and how can I make that work?

Thanks in advance!

Dear Moresheth,

Can you upload your jar file here?

I am new in wowza and i am not familiar with java, i was tried your code for recording stream in .mp4, but unable to success, so i request to you please share your file…

Regards,