Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories


How to re-stream RTSP stream with Wowza Media Server

Ástþór IPÁstþór IP

When publishing live streams to the public from IP camera or other source, you will in most cases need a streaming server to re-stream the source for security purposes and to be able to handle the traffic. Wowza is great for that! Here’s how to install it and set up a live RTSP re-stream.

Install Java Runtime Environment (JRE)

1. Add non-free packages to apt sources (pico /etc/apt/sources.list)

Add "non-free" behind "main" for all lines in the file. For example, change:
 
deb http://ftp.debian.org/debian/ squeeze main
deb-src http://ftp.debian.org/debian/ squeeze main
 
to
 
deb http://ftp.debian.org/debian/ squeeze main non-free
deb-src http://ftp.debian.org/debian/ squeeze main non-free

2. Update apt

apt-get update

3. Install Sun Java runtime environment (JRE)

apt-get install sun-java6-bin sun-java6-jre

Install Wowza Media Server

4. Download Wowza Media Server

wget http://www.wowza.com/downloads/WowzaMediaServer-3-1-2/WowzaMediaServer-3.1.2.deb.bin

Find a link to the latest version on http://www.wowza.com/pricing/installer

5. Make the package executable

chmod +x WowzaMediaServer-3.1.2.deb.bin

6. Run the installer

./WowzaMediaServer-3.1.2.deb.bin

7. Set the license key (You can request a free 30 day trial here: http://www.wowza.com/pricing/trial)

echo "licensekey" > /usr/local/WowzaMediaServer/conf/Server.license

Replace licensekey with your actual license key

8. Set the admin password for stream manager. Stream manager is a web interface where you can start and stop your streams, accessible on the the location: http://yourserver:8086/streammanager (optional)

echo "{username} {password}" > /usr/local/WowzaMediaServer/conf/admin.password

Replace {username} and {password} with a username and password of choice.

Set up the stream

9. Create a directory containing the Application.xml file for the stream

mkdir /usr/local/WowzaMediaServer/conf/live

10. Insert the application settings (pico /usr/local/WowzaMediaServer/conf/live/Application.xml)

<Root>
<Application>
<Connections>
<AutoAccept>true</AutoAccept>
<AllowDomains></AllowDomains>
</Connections>
<Streams>
<StreamType>live</StreamType>
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/content</StorageDir>
<KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
<LiveStreamPacketizers>cupertinostreamingpacketizer,smoothstreamingpacketizer,sanjosestreamingpacketizer</LiveStreamPacketizers>
<Properties>
</Properties>
</Streams>
<Transcoder>
<LiveStreamTranscoder>transcoder</LiveStreamTranscoder>
<Templates>${SourceStreamName}.xml,transcode.xml</Templates>
<ProfileDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/profiles</ProfileDir>
<TemplateDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/templates</TemplateDir>
<Properties>
</Properties>
</Transcoder>
<DVR>
<Recorders></Recorders>
<Store></Store>
<WindowDuration>0</WindowDuration>
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/dvr</StorageDir>
<ArchiveStrategy>append</ArchiveStrategy>
<Repeater>
<ChunkOriginURL></ChunkOriginURL>
</Repeater>
<Properties>
</Properties>
</DVR>
<HTTPStreamers>cupertinostreaming,smoothstreaming,sanjosestreaming</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>
<Authentication>
<PublishMethod>digest</PublishMethod>
<PlayMethod>none</PlayMethod>
</Authentication>
<AVSyncMethod>senderreport</AVSyncMethod>
<MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
<IdleFrequency>75</IdleFrequency>
<RTSPSessionTimeout>90000</RTSPSessionTimeout>
<RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
<RTSPBindIpAddress></RTSPBindIpAddress>
<RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress>
<RTSPOriginIpAddress>127.0.0.1</RTSPOriginIpAddress>
<IncomingDatagramPortRanges>*</IncomingDatagramPortRanges>
<Properties>
</Properties>
</RTP>
<MediaCaster>
<RTP>
<RTSP>
<RTPTransportMode>interleave</RTPTransportMode>
</RTSP>
</RTP>
<Properties>
</Properties>
</MediaCaster>
<MediaReader>
<Properties>
</Properties>
</MediaReader>
<MediaWriter>
<Properties>
</Properties>
</MediaWriter>
<LiveStreamPacketizer>
<Properties>
</Properties>
</LiveStreamPacketizer>
<HTTPStreamer>
<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>
</Modules>
<Properties>
</Properties>
</Application>
</Root>

11. Add the new stream into StartupStreams to make it start when Wowza is started (pico /usr/local/WowzaMediaServer/conf/StartupStreams.xml)

Add these lines to Root\StartupStreams
 
<StartupStream>
<Application>live/_definst_</Application>
<MediaCasterType>rtp</MediaCasterType>
<StreamName>camera.stream</StreamName>
</StartupStream>

12. Create the application directory

mkdir /usr/local/WowzaMediaServer/applications/live

13. Set the source RTSP server (The source stream must be H.264 encoded (MPEG-4 part 10). For other codecs, transcoding may be required.)

echo "rtsp://server/video.mp4" > /usr/local/WowzaMediaServer/content/camera.stream

Change rtsp://server/video.mp4 to the RTSP stream you want to re-stream with Wowza

14. Restart the server

/etc/init.d/WowzaMediaServer restart

Now you can view the stream in VLC or any other client capable of streaming RTSP. The location will be like this: rtsp://youserver:1935/live/camera.stream

Comments 3
  • Nigerian Forum
    Posted on

    Nigerian Forum Nigerian Forum

    Author

    Thanks so much I’m grateful.


  • Akhtar
    Posted on

    Akhtar Akhtar

    Author

    Please explain point 13. In which file i need to put this code. I am using Windows environment.


  • aip
    Posted on

    aip aip

    Author

    @Akhtar: When using Windows, simply open WowzaMediaServer/content/camera.stream in Notepad and insert the location to your source rtsp stream into the file.