Wowza Community

Programmatic Control of the Transcoder

Hi there.

We would like to control the number and bitrate of the HLS levels generated on an input stream by input stream basis. We would like to do this dynamically, so I would assume programmatically.

For instance:

  • When receiving stream name abc, transcode to: 2 levels @1Mb and 2Mb

  • When receiving stream name xyz, transcode to: 3 levels @500kb, 1Mb, 3Mb

I’ve had a look through the forums and the API and haven’t been able to figure out if this is possible. Could you let me know if (and if so, how) there is a way to do this please?

Thanks,

Henry

Hi Henry.

You can match template names with stream names, and remove the specific template name (i.e.transrate.xml, transcode.xml) from Application.xml file.

<Templates>${SourceStreamName}.xml</Templates>

if you only have a template named myStream.xml you will only transcode streams named myStream. if you also have a template named yourStream.xml, streams named “myStream” and “yourStream” will be transcoded using those templates, and other streams will not be transcoded.

Salvadore

You’re welcome Henry.

I do not have an answer for your last question. Best I can do is send your request on to Wowza as a feature request.

Best,

Salvadore

Hello

You could take a look at the ILiveStreamTranscoderNotify and ILiveStreamTranscoderActionNotify interfaces. and dynamically choose your template file. Setup the following event handlers as indicated in this post. Then you can choose the template required by leveraging the liveStreamTranscoder object within the ILiveStreamTranscoderActionNotify.onInitBeforeLoadTemplate event handler as follows:

liveStreamTranscoder.setTemplateName("TemplateName.xml");

Thanks,

Matt

Hi Salvadore.

Thanks for this!

Are there any plans to support dynamic configuration of the transcode parameters in the future? (rather than having to pre-define rates in XML)

Henry

Great, thanks Salvadore!

Yours,

Henry

Thanks Matt. There are two problems I see with this approach :

i) The best we can manage is ‘notchy’ levels, i.e. preset levels defined in the XML. It would be ‘nicer’ if we had full, programmatic control, but I guess predefined is acceptable. Furthermore, there’s no other solution, so we don’t have a lot of choice but to accept it :slight_smile:

ii) If we want to dynamically enable/disable on a per HLS level basis (e.g. enable 128k, disable 256k, enable 512k, enable 1Mb) then we’ll need XML templates containing all the permutations of these combinations. This is kind of a pain.

Am I missing something, or is this the case? Any thoughts as to a more elegant solution to ii) ?

Thanks,

Henry

I think I’ve come up with a way of working around the requirement to have templates containing all the permutations of levels. The proposed solution is:

  1. Set up a transcode template per level (200k, 500k, 1Mb, etc, etc)

  2. Issue an call to our HTTProvider2Base based plugin to Wowza saying stream name: abc123 should use templates: 200k.xml, 1Mb.xml

  3. Add code to our Wowza plugin to start transcoders with the profiles listed in 2) when we start receiving the stream name defined in 1)

  4. Generate the root m3u8 in our (separate) application which proxies m3u8 calls to Wowza and references the specific levels generated.

I think this should work and give us the flexibility we require.

The only catch is with implementing 3). I can see in the Application.xml file that you can specify multiple transcode templates:

transcoder

audioonly.xml

${com.wowza.wms.context.VHostConfigHome}/transcoder/profiles

${com.wowza.wms.context.VHostConfigHome}/transcoder/templates

But I haven’t figured out how to do this from the API. I’m hoping that one of the callbacks allows you to configure the template names to use for a given stream.

Could you point me in the direction of such a call please?