• How to control which streams get transcoded using server-side API

    Note: Wowza Media Server™ 3 (or later) is required.

    Below is a simple module that uses the ILiveStreamTranscoderControl interface to control which streams get transcoded:

    package com.wowza.wms.plugin.test.module;
    
    import com.wowza.wms.stream.*;
    import com.wowza.wms.stream.livetranscoder.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.application.*;
    
    public class ModuleTranscoderControlByStream extends ModuleBase
    {
    	class TranscoderControl implements ILiveStreamTranscoderControl
    	{
    		public boolean isLiveStreamTranscode(String transcoder, IMediaStream stream)
    		{
    			// here is there you return true or false if you want stream transcoded
    			if ( stream.isTranscodeResult() ) 
    			{ 
    				return false; 
    			} else {
    				return true;
    			}			
    			
    		}
    	}
    	
    	public void onAppStart(IApplicationInstance appInstance)
    	{
    		appInstance.setLiveStreamTranscoderControl(new TranscoderControl());
    	}
    }
    Add logic to the isLiveStreamTranscode to control which streams are transcoded.

    To add this module to your application, edit [install-dir]/conf/[application]/Application.xml and add this module entry as the last <Module> entry in the <Modules> list:

    <Module>
    	<Name>ModuleTranscoderControlByStream</Name>
    	<Description>ModuleTranscoderControlByStream</Description>
    	<Class>com.wowza.wms.plugin.test.module.ModuleTranscoderControlByStream</Class>
    </Module>

    If you're having problems or want to discuss this article, post in our forum.