How to modify or fix SDP data sent from IP cameras

You can create a class the overrides the code that's used to communicate with IP cameras and can modify the RTSP request sent to the IP camera and modify the resultant SDP data that's sent to Wowza media servers to publish the stream. Create this class, and add to a JAR file in the Wowza media server [install-dir]/lib folder.

The following sample class overrides the default RTSP handler:

package com.wowza.wms.plugin.rtpprovideroverride;

import com.wowza.wms.mediacaster.rtp.*;
import com.wowza.wms.logging.*;

public class RTPSessionDescriptionDataProviderOverride extends RTPSessionDescriptionDataProviderBasic
{
	protected void rtspMessageHook(RTPSessionDescriptionDataProviderBasicRTSPRequest request)
	{
		// Here you can modify the RTSP message requests
		//request.addHeader("X-No-Keepalive", "1");
	}

	protected String filterSessionDescriptionData(String streamInfo)
	{
		// Here you can modify the SDP data that is sent to Wowza for publishing
		//streamInfo = streamInfo.replace("profile-level-id", "hide-profile-level-id");

		return streamInfo;
	}

}
Edit [install-dir]/conf/[application-name]/Application.xml and add the following property to the <MediaCaster>/<Properties> container (be sure to get the proper container - there are several in the Application.xml file):
<Property>
	<Name>rtpSessionDescriptionDataProviderClass</Name>
	<Value>com.wowza.wms.plugin.rtpprovideroverride.RTPSessionDescriptionDataProviderOverride </Value>
</Property>

Originally Published: 01-06-2011.

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