Help with RTSP live streaming to Android

We’re trying to live stream RTSP to Android and running into issues.

The same videos files in our (server-side) live stream play fine on-demand on Android devices, so I don’t think it’s an encoding/decoding issue, but not 100% sure. We’ve tried several different encoding settings - all with the same result. Which leads me to believe we may have something misconfigured in Wowza. We followed the Wowza guide for RTSP and double-checked everything… but maybe we missed something?

Our live streams load (sometimes taking 30 seconds or more) and start to play on Android devices, but the stream eventually starts dropping frames and pixelating. After several minutes, the stream eventually “degrades” to nothing and stops playing.

Here’s one of our streams:

rtsp://media2.tripsmarter.com/LiveTV/BTV/

I’ve seen other examples of what I think are RTSP live streams and they play without these problems.

We’ve ruled out network/bandwidth issues (local and remote) so we are back to looking at our Wowza config. The test stream above is running on Wowza Media Server 2 Perpetual 2.2.4.02 build27547 - BUT, we’ve tested on a Wowza 3 server and ended up with the same results. Behavior is the same on Android 2.x devices and 3.x devices.

Any advice?

Application.xml:

<Root>
	<Application>
		<!-- Uncomment to set application level timeout values
		<ApplicationTimeout>60000</ApplicationTimeout>
		<PingTimeout>12000</PingTimeout>
		<ValidationFrequency>8000</ValidationFrequency>
		<MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
		<MaximumSetBufferTime>60000</MaximumSetBufferTime>
		<MaximumStorageDirDepth>25</MaximumStorageDirDepth>
		-->
		<Connections>
			<AutoAccept>true</AutoAccept>
			<AllowDomains></AllowDomains>
		</Connections>
		<!--
			StorageDir path variables
			
			${com.wowza.wms.AppHome} - Application home directory
			${com.wowza.wms.ConfigHome} - Configuration home directory
			${com.wowza.wms.context.VHost} - Virtual host name
			${com.wowza.wms.context.VHostConfigHome} - Virtual host config directory
			${com.wowza.wms.context.Application} - Application name
			${com.wowza.wms.context.ApplicationInstance} - Application instance name
			
		-->
		<Streams>
			<StreamType>live</StreamType>
			<!-- <StorageDir>${com.wowza.wms.context.VHostConfigHome}/content</StorageDir> -->
			<StorageDir>/home/media2/www/tv</StorageDir>
			<KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
			<!-- LiveStreamPacketizers (separate with commas): cupertinostreamingpacketizer, smoothstreamingpacketizer, cupertinostreamingrepeater, smoothstreamingrepeater -->
			<LiveStreamPacketizers>cupertinostreamingpacketizer,smoothstreamingpacketizer</LiveStreamPacketizers>			
			<!-- Properties defined here will override any properties defined in conf/Streams.xml for any streams types loaded by this application -->
			<Properties>
			</Properties>
		</Streams>
		<!-- HTTPStreamers (separate with commas): cupertinostreaming, smoothstreaming -->
		<HTTPStreamers>cupertinostreaming,smoothstreaming</HTTPStreamers>			
		<SharedObjects>
			<StorageDir></StorageDir>
		</SharedObjects>
		<Client>
			<IdleFrequency>-1</IdleFrequency>
			<Access>
				<StreamReadAccess>*</StreamReadAccess>
				<StreamWriteAccess>*</StreamWriteAccess>
				<StreamAudioSampleAccess></StreamAudioSampleAccess>
				<StreamVideoSampleAccess></StreamVideoSampleAccess>
				<SharedObjectReadAccess>*</SharedObjectReadAccess>
				<SharedObjectWriteAccess>*</SharedObjectWriteAccess>
			</Access>
		</Client>
		<RTP>
			<!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
			<Authentication>
				<PublishMethod>digest</PublishMethod>
				<PlayMethod>none</PlayMethod>
			</Authentication>
			<!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode -->
			<AVSyncMethod>senderreport</AVSyncMethod>
			<MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
			<IdleFrequency>75</IdleFrequency>
			<RTSPSessionTimeout>90000</RTSPSessionTimeout>
			<RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
			<RTSPBindIpAddress>64.64.1.154</RTSPBindIpAddress>
			<RTSPConnectionIpAddress>64.64.1.154</RTSPConnectionIpAddress>
			<RTSPOriginIpAddress>64.64.1.154</RTSPOriginIpAddress>
			<IncomingDatagramPortRanges>*</IncomingDatagramPortRanges>
			<!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application -->
			<Properties>
			</Properties>
		</RTP>
		<MediaCaster>
			<!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications -->
			<Properties>
			</Properties>
		</MediaCaster>
		<MediaReader>
			<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
			<Properties>
			</Properties>
		</MediaReader>
		<MediaWriter>
			<!-- Properties defined here will override any properties defined in conf/MediaWriter.xml for any MediaWriter loaded by this applications -->
			<Properties>
			</Properties>
		</MediaWriter>
		<LiveStreamPacketizer>
			<!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications -->
			<Properties>
			</Properties>
		</LiveStreamPacketizer>
		<HTTPStreamer>
			<!-- Properties defined here will override any properties defined in conf/HTTPStreamers.xml for any HTTPStreamer loaded by this applications -->
			<Properties>
			</Properties>
		</HTTPStreamer>
		<Repeater>
			<OriginURL></OriginURL>
			<QueryString><![CDATA[]]></QueryString>
		</Repeater> 
		<Modules>
			<Module>
				<Name>base</Name>
				<Description>Base</Description>
				<Class>com.wowza.wms.module.ModuleCore</Class>
			</Module>
			<Module>
				<Name>properties</Name>
				<Description>Properties</Description>
				<Class>com.wowza.wms.module.ModuleProperties</Class>
			</Module>
			<Module>
				<Name>logging</Name>
				<Description>Client Logging</Description>
				<Class>com.wowza.wms.module.ModuleClientLogging</Class>
			</Module>
			<Module>
				<Name>flvplayback</Name>
				<Description>FLVPlayback</Description>
				<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
			</Module>
	                <Module>
			        <Name>hotlinkdenial</Name>
			    	<Description>Hotlink Denial Module</Description>
			    	<Class>com.wowza.wms.plugin.collection.module.ModuleHotlinkDenial</Class>
			</Module>
		</Modules>
		<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
		<Properties>
	                <Property>
	    	                <Name>domainLock</Name>
	    	                <Value>removed for forum post</Value>
	                </Property>
			<Property>
				<Name>smoothStreamingMediaMajorVersion</Name>
				<Value>2</Value>
				<Type>Integer</Type>
			</Property>
		</Properties>
	</Application>
</Root>

Video info:

File size                        : 2.47 MiB
Duration                         : 30s 0ms
Overall bit rate                 : 691 Kbps
Encoded date                     : UTC 2012-03-07 18:30:29
Tagged date                      : UTC 2012-03-07 18:30:29
Writing library                  : Apple QuickTime
Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : Baseline@L2.2
Format settings, CABAC           : No
Format settings, ReFrames        : 3 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 30s 0ms
Bit rate mode                    : Variable
Bit rate                         : 593 Kbps
Width                            : 640 pixels
Height                           : 480 pixels
Display aspect ratio             : 4:3
Frame rate mode                  : Constant
Frame rate                       : 15.000 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.129
Stream size                      : 2.12 MiB (86%)
Language                         : English
Encoded date                     : UTC 2012-03-07 18:30:29
Tagged date                      : UTC 2012-03-07 18:30:29
Audio
ID                               : 2
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format profile                   : LC
Codec ID                         : 40
Duration                         : 29s 976ms
Bit rate mode                    : Variable
Bit rate                         : 96.0 Kbps
Maximum bit rate                 : 104 Kbps
Channel(s)                       : 2 channels
Channel positions                : Front: L R
Sampling rate                    : 44.1 KHz
Compression mode                 : Lossy
Stream size                      : 352 KiB (14%)
Language                         : English
Encoded date                     : UTC 2012-03-07 18:30:29
Tagged date                      : UTC 2012-03-07 18:30:29

Go through this guide carefully, make sure you follow the link in step 3 and use the mobile test page

https://www.wowza.com/docs/how-to-troubleshoot-rtsp-rtp-playback

Simplified encoding and lower bitrate might be the key in your case. Take a look at the suggestions for mobile in this article:

https://www.wowza.com/docs/how-to-encode-video-on-demand-content

Richard

Trip,

I played your link: rtsp://media2.tripsmarter.com/LiveTV/BTV/

On my Gzone Commando, Android 2.2.1 in the free “Doga” player, via WiFi. The stream started in 3 seconds and the audio and video are perfect. After 7 minutes the stream looks just as good. Perhaps you’ve solved the problem? If not, please describe how you’re doing your live encoding to Wowza in more detail.

Edit: I spoke too soon. After 12 minutes I started seeing the corruption you described. My hunch is that it’s bandwidth related. Install the BWChecker example on your server, have that running and check if you see any degraded bandwidth correlated with the corruption. Also try your setup with the sample.mp4 file. If that works fine, this would point to some issue with your encoding/encoder. Richard’s suggestions will help with that.