# Selecting transcoder profile on server side API

**URL:** <https://community.wowza.com/t/selecting-transcoder-profile-on-server-side-api/687>\
**Category:** Wowza Streaming Engine\
**Created:** [January 28, 2014, 2:49pm UTC](https://community.wowza.com/t/selecting-transcoder-profile-on-server-side-api/687 "2014-01-28T14:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [January 28, 2014, 2:49pm UTC](https://community.wowza.com/t/selecting-transcoder-profile-on-server-side-api/687/1 "2014-01-28T14:49:13Z")

</div>

Hi there … I want to use something like mentioned on following post to select which stream to transcode ([https://www.wowza.com/docs/how-to-control-which-streams-get-transcoded-using-server-side-api](https://www.wowza.com/docs/how-to-control-which-streams-get-transcoded-using-server-side-api))

Is there any way to select at same time, through server side API, which transcoder profile to use for each stream?

I want to tell which stream to transcode, and which profile of the 3 I will have to use for each stream

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Roger\_Littin1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Roger\_Littin1](https://community.wowza.com/u/Roger_Littin1)\
**Post date:** [January 29, 2014, 1:19pm UTC](https://community.wowza.com/t/selecting-transcoder-profile-on-server-side-api/687/2 "2014-01-29T13:19:12Z")

</div>

Hi,

The easiest way to do this will be to implement the ILiveStreamTranscoderActionNotify interface which has a method, onInitBeforeLoadTemplate(LiveStreamTranscoder liveStreamTranscoder);, which is called right before the template is loaded. In this method, you can specify the name of the template that you want to load.

To implement the interface, you can do the following.

[PHP]

// Add a Transcoder listener to the appInstance.

appInstance.addLiveStreamTranscoderListener(new MyTranscoderCreateNotifier());

. . .

// Listener class that listens for transcoder create events and registers the transcoder action notifier class.

class MyTranscoderCreateNotifier implements ILiveStreamTranscoderNotify

{

@Override

public void onLiveStreamTranscoderCreate(ILiveStreamTranscoder liveStreamTranscoder, IMediaStream stream)

{

((LiveStreamTranscoder)liveStreamTranscoder).addActionListener(new MyTranscoderActionNotifier());

}

@Override

public void onLiveStreamTranscoderDestroy(ILiveStreamTranscoder liveStreamTranscoder, IMediaStream stream)

{

}

@Override

public void onLiveStreamTranscoderInit(ILiveStreamTranscoder liveStreamTranscoder, IMediaStream stream)

{

}

}

// Listener class that listens for transcoder actions. This class extends LiveStreamTranscoderActionNotifyBase which already implements all of the ILiveStreamTranscoderActionNotify methods so you only override the methods you need.

class MyTranscoderActionNotifier extends LiveStreamTranscoderActionNotifyBase

{

// get the templateName from somewhere and set it here.

@Override

public void onInitBeforeLoadTemplate(LiveStreamTranscoder liveStreamTranscoder)

{

String templateName = “myStream.xml”;

liveStreamTranscoder.setTemplateName(templateName);

}

}

[/PHP]

You can also use this along side the transcoder control interface to control what actually gets transcoded.

Roger.

---

<div class="post-metadata">

**Author:** ![Johan\_Niemi](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@Johan\_Niemi](https://community.wowza.com/u/Johan_Niemi)\
**Post date:** [February 10, 2014, 2:23am UTC](https://community.wowza.com/t/selecting-transcoder-profile-on-server-side-api/687/3 "2014-02-10T02:23:10Z")

</div>

To expand this a little, can you specify the name of the template that you want to load in the stream name used on the encoder?

For example:

```auto
Server URL: rtmp://10.10.10.10/live
Stream name: myStream,transrate1

```

Results in rtmp://10.10.10.10/live/myStream being transcoded with the settings in **transrate1.xml**

```auto
Server URL: rtmp://10.10.10.10/live
Stream name: myStream,transrate8

```

Results in rtmp://10.10.10.10/live/myStream being transcoded with the settings in **transrate8.xml**

Is it doable?
