Note: Updated for Wowza Media Server 3 Preview 3
Tutorial on how to use the Live Stream Transcoder AddOn that is included in the Wowza Media Server 3 Preview. This AddOn provides the ability to decode the video and audio of an incoming stream and re-encode it to suite the desired playback device or devices. The newly encoded streams will be key frame aligned with the incoming source stream such that multi-bitrate delivery is possible. The transcoder uses a templating system to match the incoming stream to an encoding template that is used to control the encoding parameters of the resulant transcoded streams. There are two default templates in the [install-dir]/transcoder/templates folder that cover the two most common workflows transrate.xml and transcode.xml.
Hardware and Driver Requirements
The Live Stream Transcoder is supported on:
- Windows 64-bit
- Linux 64-bit
Note: 32-bit operating systems are not supported and OSX is not supported.
On Windows, the transcoder supports Intel Quick Sync (Sandy Bridge) and NVidia CUDA acclerated H.264 encoding. In the final release of the Live Stream Transcoder we hope to support for NVidia CUDA accelerated H.264 encoding on Linux. Links to more information regarding the hardware requirements for each of these technologies below. If using accelerated hardware, run Wowza Server in standalone mode. Running as a service will invoke the default MainConcept software encoder.
Accelerated Hardware and Driver Requirements
Supported Video and Audio Codecs
The Live Stream Transcoder supports the following video and audio codecs:
- Video decoding: H.264, MPEG2, MPEG4 Part 2
- Video encoding: H.264
- Audio decoding: AAC, MP3, MPEG 1 Part 1/2
- Audio encoding: AAC
Transcoder Templates
The Live Stream Transcoder templating system includes a method for grouping streams together into logical groups for multi-bitrate delivery. In Wowza Media Server 2 stream grouping was accomplished using SMIL (Synchronized Multimedia Integration Language) files. In the Live Stream Transcoder templating system streams are grouped using StreamNameGroups. These groups are defined in the transcoding template and are available when streaming using the ngrp: stream name prefix.
Tutorial
Below are the steps for setting up an application for transcoding:
- Create application folder [install-dir]/applications/live
- Create configuration folder [install-dir]/conf/live and copy [install-dir]/conf/Application.xml into this new folder
- Edit the newly copied Application.xml file and make the following changes (some of these settings may already be present):
- Set the Streams/StreamType property to: live
Code:<StreamType>live</StreamType>- Set the HTTPStreamers property to: cupertinostreaming, smoothstreaming, sanjosestreaming
Code:<HTTPStreamers>cupertinostreaming,smoothstreaming,sanjosestreaming</HTTPStreamers>- Set the Streams/LiveStreamPacketizers property to: cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer:
Code:<LiveStreamPacketizers>cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer</LiveStreamPacketizers>- Set the RTP/Authentication/PlayMethod to: none
Code:<PlayMethod>none</PlayMethod>- Set the Transcoder/LiveStreamTranscoder to: transcoder
Code:<LiveStreamTranscoder>transcoder</LiveStreamTranscoder>- If the incoming stream is H.264 video and AAC or MP3 audio and you want to create multi-bitrate renditions of the incoming stream for multi-bitrate delivery, then set Transcoder/Templates value to:
If the incoming stream is MPEG2 or MPEG4 Part 2 video and requires transcoding to H.264 and AAC for delivery to the supported player technologies such as Flash, iOS and Silverlight, then set Transcoder/Templates value to:Code:<Templates>${SourceStreamName}.xml,transrate.xml</Templates>
Note: Multi-bitrate delivery is supported when using transcode.xml.Code:<Templates>${SourceStreamName}.xml,transcode.xml</Templates>
- RTSP/RTP encoder only: Edit [install-dir]/conf/publish.password and add a user name and password to control RTSP/RTP publishing access (below is an example of the file with the username myuser and password mypassword):
Code:# Publish password file (format [username][space][password]) # username password myuser mypassword- Start Wowza Media Server 3
- With this setup, you can now follow one of the live streaming tutorials here to futher modify [install-dir]/conf/live/Application.xml and send a stream from your encoder to Wowza Server for transcoding:
Tutorials
If you use the provided transrate.xml or transcode.xml templates the transcoded streams will have the stream names:
- [stream-name]_360p: Main profile stream
- [stream-name]_160p: Baseline profile stream
- ngrp:[stream-name]_all: Adaptive bitrate stream for Apple iOS (cupertino), Smooth Streaming and Flash HTTP (sanjose) streaming
Where [stream-name] is the name of the stream you are sending from the encoder to Wowza Server. For example if the incoming stream from the encoder is myStream then the transcoded streams will be myStream_360p, myStream_160p and ngrp:myStream_all.
How it works
The way it works if very simple. All incoming streams that are published to the live application will also be transcoded based on the template that is configured using the Transcoder/Templates setting in [install-dir]/conf/[application]/Application.xml. You can transcode a single incoming stream to as many new streams as you like.
Let's take a closer look at a transcoder template. Below is the transrate.xml template that ships with the product (updated for Wowza Server 3 Preview 4 Patch 4):
Details:Code:<!-- Example template for transrate, producing four new streams at different bitrates. Resultant streams can be played back individually or as a group. source, 360p and 160p encode blocks are enabled through the Enable property, other examples are not enabled. Add additional encode blocks to your template as needed. --> <Root> <Transcode> <Encodes> <!-- Example Encode block for source, not required unless Member of StreamNameGroup. --> <Encode> <Enable>true</Enable> <Name>source</Name> <StreamName>mp4:${SourceStreamName}_source</StreamName> <Video> <!-- H.264, PassThru --> <Codec>PassThru</Codec> <Bitrate>${SourceVideoBitrate}</Bitrate> <Parameters> </Parameters> </Video> <Audio> <!-- AAC, PassThru --> <Codec>PassThru</Codec> <Bitrate>${SourceAudioBitrate}</Bitrate> </Audio> <Properties> </Properties> </Encode> <!-- Setup for 720p, high bandwith, main profile for desktop or set-top box --> <Encode> <Enable>false</Enable> <Name>720p</Name> <StreamName>mp4:${SourceStreamName}_720p</StreamName> <Video> <!-- H.264, PassThru --> <Codec>H.264</Codec> <!-- default, CUDA, QuickSync --> <Transcoder>default</Transcoder> <FrameSize> <!-- letterbox, fit-width, fit-height, crop, stretch, match-source --> <FitMode>fit-height</FitMode> <Width>1280</Width> <Height>720</Height> </FrameSize> <Profile>main</Profile> <Bitrate>1300000</Bitrate> <KeyFrameInterval> <FollowSource>true</FollowSource> <Interval>60</Interval> </KeyFrameInterval> <Overlays> <Overlay> <Enable>false</Enable> <Index>0</Index> <ImagePath>${com.wowza.wms.context.VHostConfigHome}/content/wowzalogo.png</ImagePath> <Opacity>100</Opacity> <Location> <X>5</X> <Y>5</Y> <Width>${ImageWidth}</Width> <Height>${ImageHeight}</Height> <!-- horiz: left, right, hcenter - vert: top, bottom, vcenter --> <Align>left,top</Align> </Location> </Overlay> </Overlays> <Parameters> </Parameters> </Video> <Audio> <!-- AAC, PassThru --> <Codec>PassThru</Codec> <Bitrate>${SourceAudioBitrate}</Bitrate> </Audio> <Properties> </Properties> </Encode> <!-- Setup for 360p, high bandwith, main profile for desktop --> <Encode> <Enable>true</Enable> <Name>360p</Name> <StreamName>mp4:${SourceStreamName}_360p</StreamName> <Video> <!-- H.264, PassThru --> <Codec>H.264</Codec> <!-- default, CUDA, QuickSync --> <Transcoder>default</Transcoder> <FrameSize> <!-- letterbox, fit-width, fit-height, crop, stretch, match-source --> <FitMode>fit-height</FitMode> <Width>640</Width> <Height>360</Height> </FrameSize> <Profile>main</Profile> <Bitrate>850000</Bitrate> <KeyFrameInterval> <FollowSource>true</FollowSource> <Interval>60</Interval> </KeyFrameInterval> <Overlays> <Overlay> <Enable>false</Enable> <Index>0</Index> <ImagePath>${com.wowza.wms.context.VHostConfigHome}/content/wowzalogo.png</ImagePath> <Opacity>100</Opacity> <Location> <X>5</X> <Y>5</Y> <Width>${ImageWidth}</Width> <Height>${ImageHeight}</Height> <!-- horiz: left, right, hcenter - vert: top, bottom, vcenter --> <Align>left,top</Align> </Location> </Overlay> </Overlays> <Parameters> </Parameters> </Video> <Audio> <!-- AAC, PassThru --> <Codec>PassThru</Codec> <Bitrate>${SourceAudioBitrate}</Bitrate> </Audio> <Properties> </Properties> </Encode> <!-- Setup for 240p, medium bandwidth, baseline profile --> <Encode> <Enable>false</Enable> <Name>240p</Name> <StreamName>mp4:${SourceStreamName}_240p</StreamName> <Video> <!-- H.264, PassThru --> <Codec>H.264</Codec> <!-- default, CUDA, QuickSync --> <Transcoder>default</Transcoder> <FrameSize> <!-- letterbox, fit-width, fit-height, crop, stretch, match-source --> <FitMode>fit-height</FitMode> <Width>360</Width> <Height>240</Height> </FrameSize> <Profile>baseline</Profile> <Bitrate>350000</Bitrate> <KeyFrameInterval> <FollowSource>true</FollowSource> <Interval>60</Interval> </KeyFrameInterval> <Overlays> <Overlay> <Enable>false</Enable> <Index>0</Index> <ImagePath>${com.wowza.wms.context.VHostConfigHome}/content/wowzalogo.png</ImagePath> <Opacity>100</Opacity> <Location> <X>5</X> <Y>5</Y> <Width>${ImageWidth}</Width> <Height>${ImageHeight}</Height> <!-- horiz: left, right, hcenter - vert: top, bottom, vcenter --> <Align>left,top</Align> </Location> </Overlay> </Overlays> <Parameters> </Parameters> </Video> <Audio> <!-- AAC, PassThru --> <Codec>PassThru</Codec> <Bitrate>${SourceAudioBitrate}</Bitrate> </Audio> <Properties> </Properties> </Encode> <!-- Setup for 160p, low bandwith, baseline profile for 3G mobile devices such as iOS, Android, Blackberry --> <Encode> <Enable>true</Enable> <Name>160p</Name> <StreamName>mp4:${SourceStreamName}_160p</StreamName> <Video> <!-- H.264, PassThru --> <Codec>H.264</Codec> <!-- default, CUDA, QuickSync --> <Transcoder>default</Transcoder> <FrameSize> <!-- letterbox, fit-width, fit-height, crop, stretch, match-source --> <FitMode>fit-height</FitMode> <Width>284</Width> <Height>160</Height> </FrameSize> <Profile>baseline</Profile> <Bitrate>200000</Bitrate> <KeyFrameInterval> <FollowSource>true</FollowSource> <Interval>60</Interval> </KeyFrameInterval> <Overlays> <Overlay> <Enable>false</Enable> <Index>0</Index> <ImagePath>${com.wowza.wms.context.VHostConfigHome}/content/wowzalogo.png</ImagePath> <Opacity>100</Opacity> <Location> <X>5</X> <Y>5</Y> <Width>${ImageWidth}</Width> <Height>${ImageHeight}</Height> <!-- horiz: left, right, hcenter - vert: top, bottom, vcenter --> <Align>left,top</Align> </Location> </Overlay> </Overlays> <Parameters> </Parameters> </Video> <Audio> <!-- AAC, PassThru --> <Codec>PassThru</Codec> <Bitrate>${SourceAudioBitrate}</Bitrate> </Audio> <Properties> </Properties> </Encode> </Encodes> <Decode> <Video> <Deinterlace>false</Deinterlace> <Overlays> <Overlay> <Enable>false</Enable> <Index>0</Index> <ImagePath>${com.wowza.wms.context.VHostConfigHome}/content/wowzalogo.png</ImagePath> <Opacity>100</Opacity> <Location> <X>5</X> <Y>5</Y> <Width>${ImageWidth}</Width> <Height>${ImageHeight}</Height> <!-- horiz: left, right, hcenter - vert: top, bottom, vcenter --> <Align>left,top</Align> </Location> </Overlay> </Overlays> <Parameters> </Parameters> </Video> <Properties> </Properties> </Decode> <StreamNameGroups> <!-- Note: Play stream using stream name ngrp:[stream-name] --> <StreamNameGroup> <Name>${SourceStreamName}_all</Name> <Members> <Member> <EncodeName>source</EncodeName> </Member> <Member> <EncodeName>720p</EncodeName> </Member> <Member> <EncodeName>360p</EncodeName> </Member> <Member> <EncodeName>240p</EncodeName> </Member> <Member> <EncodeName>160p</EncodeName> </Member> </Members> </StreamNameGroup> <StreamNameGroup> <Name>${SourceStreamName}_mobile</Name> <Members> <Member> <EncodeName>240p</EncodeName> </Member> <Member> <EncodeName>160p</EncodeName> </Member> </Members> </StreamNameGroup> </StreamNameGroups> <Properties> </Properties> </Transcode> </Root>
- <Encode>...</Encode>: This block represents an encode. A single template can have multiple <Encode> blocks.
- Enable: If set to true, the encoding block will be active. If set to false, the encoding block will be ignored. The default template has multiple <Encode> block examples, not all are not enabled. Enable or add additional encode blocks to your template as needed.
- Name: Each encode is given a name that is used in logging. This name must be unique in a given transcoding template.
- StreamName: The transcoded stream name. The ${SourceStreamName} will be replaced with the source stream name. Again, the resultant stream name must be unique for a given application. It is best to always use the source stream name as part of the destination stream name.
- Video/Codec: Video codec:
- H.264: Transcode video to H.264
- PassThru: Pass the source video stream through to this resultant stream
- Video/Transcoder: The transcoder implementation to use.
- default: MainConcept software encoder (not hardware accelerated)
- QuickSync: (Windows only): Intel Quick Sync (Sandy Bridge) encoding acceleration. If your current hardware does not support the SandyBridge instruction set, the unaccelerated software encoder will be used.
- CUDA: (Windows only): NVidia CUDA encoding acceleration. If your current hardware does not support the CUDA instruction set, the encode will fail.
- Video/GPUID: CUDA GPUID to use for transcoding. A value of -1 tells the software to select the highest capacity GPU. GPU's are numbered starting at zero and are enumerated when transcoder is started.
- Video/FrameSize: The transcoded frame size.
- letterbox: Will maintain aspect ratio of the source video and will scale to fit the destination frame size with black bars to fill empty space
- fit-width: Will adjust the height to fit the specificied width and maintain the incoming aspect ratio
- fit-height: Will adjust the width to fit the specificied height and maintain the incoming aspect ratio
- crop: Will maintain aspect ratio of the source video and will scale to fit the destination frame size and will crop the source video to fit destination frame size
- stretch: Stretch the video to the fit the specified width and height
- match-source: Frame width and height will be the same as the source video
- Video/Crop: Gives you the ability to crop the source video frame. The values represent the number of pixels to crop on the left, right, top, bottom of the source video frame.. Cannot be used with <SourceRectangle>. New in preview 2 patch 6.
- Video/SourceRectangle: Gives you the ability to select only a portion of the source video farme. The values represent the top, left, width, height of the rectangle. Cannot be used with <Crop>. New in preview 2 patch 6.
- Video/Profile: Video profile.
- baseline: Lowest complexity stream for mobile streaming
- main: Higher complexity and quality stream for desktop and over the top streaming
- Video/Bitrate: Target video bitrate in bits per second
- Video/KeyFrameInterval: Key frame interval.
- Video/KeyFrameInterval/FollowSource: If true, key frame interval of the transcoded video will match the source video's key frame interval. If false, the KeyFrameInterval/Interval will determine the key frame interval.
- Video/KeyFrameInterval/Interval: How often key frames are generated. Every Nth frame will be a key frame.
- Video/Overlays: (New in Wowza Server 3 Preview 4 Patch 4 or greater): Graphic overlay such as a watermark
- Video/Overlay/Enable: Set to true to enable overlay.
- Video/Overlay/Index: Overlay z-order.
- Video/Overlay/ImagePath: Path to the overlay image (JPEG, PNG and BMP image files are supported)
- Video/Overlay/Opacity: Overlay opacity. Valid values are between 0-100. Zero being completely transparent and 100 being completely opaque.
- Video/Overlay/Location/X & Y: Offset of overlay from base position. Negative values are valid.
- Video/Overlay/Location/Width & Height: Width and Height of overlay if set to ${ImageWidth} and ${ImageHeight} will use image size.
- Video/Overlay/Location/Align: Default location of overlay. For example if set to right, bottom and X and Y set to -10 and -10, overlay will be placed 10 pixels from the bottom right hand corner of the output frame.
- Video/Parameters: Individual encoding parameters that are implementation specific to control the encoding process (this feature will be documented later).
- Audio/Codec: Audio codec:
- AAC: Transcode video to AAC
- PassThru: Pass the source audio stream through to this resultant stream
- Audio/Bitrate: Target audio bitrate in bits per second (ignored if PassThru)
- ${SourceStreamName}: Variable that will be replaced with the source stream name
- ${SourceVideoBitrate}: Variable that will be replaced with the video bitrate of the source stream (can only be used if Video/Codec is PassThru)
- ${SourceAudioBitrate}: Variable that will be replaced with the audio bitrate of the source stream (can only be used if Audio/Codec is PassThru)
- <StreamNameGroup></StreamNameGroup>: This block represents a group of streams that can be played using multi-bitrate streaming. The <Name> is the name of the stream name group and is used to play the multi-bitrate stream when using iOS, Flash HTTP or smooth streaming. For example if the incoming stream name is myStream then the above stream name group name is myStream_all. To play this multi-bitrate live stream using each of the player technologies the URLs would be:
Code:To play using an Apple iOS device (Cupertino/Apple HTTP Live Streaming): http://[wowza-ip-address]:1935/live/ngrp:myStream_all/playlist.m3u8 To play using Adobe Flash player (San Jose/Flash HTTP): http://[wowza-ip-address]:1935/live/ngrp:myStream_all/manifest.f4m To play using Microsoft Silverlight (Smooth Streaming): http://[wowza-ip-address]:1935/live/ngrp:myStream_all/Manifest
Note: To include the incoming stream in a stream name group for multi-bitrate streaming, it is best to add it as an <Encode> item with both the video and audio <Codec> set to PassThru. The <StreamName> element must result in a unique name from the incoming stream name.
Note: To create a stream name group for iOS streaming with an audio-only rendition as described in this article Adding Multi-bitrate Audio-only Rendition to iOS Streams (AppStore 64Kbps) add a <MediaListRendition> element to the stream name group with a <WowzaAudioOnly> element set to true. Here is an example:
Code:<StreamNameGroup> <Name>${SourceStreamName}_all</Name> <Members> <Member> <EncodeName>source</EncodeName> </Member> <Member> <EncodeName>360p</EncodeName> </Member> <Member> <EncodeName>160p</EncodeName> </Member> <Member> <EncodeName>160p</EncodeName> <MediaListRendition> <WowzaAudioOnly>true</WowzaAudioOnly> </MediaListRendition> </Member> </Members> </StreamNameGroup>
There are several ways to control the transcoding process:
- All transcoding sessions use the same transcoder template. This is the default configuration.
- All transcoding sessions for a particular application use the same transcoder template. To accomplish this configuration, follow these steps (in all of the instructions replace [application] with the name of the application being configured):
- Edit [install-dir]/conf/[application]/Application.xml and change the Transcoder/Templates value to [application].xml
Code:<Templates>[application].xml</Templates>- Copy the file [install-dir]/transcoder/templates/transrate.xml and name it [install-dir]/transcoder/templates/[application].xml. This file will become your transcoding template for this application.
- The transcoder template used is basd on the stream name. To accomplish this configuration, follow these steps (in all of the instructions replace [streamName] with the name of the stream being configured):
- Copy the file [install-dir]/transcoder/templates/transrate.xml and name it [install-dir]/transcoder/templates/[streamName].xml. This file will become your transcoding template for this stream.
Note: It is always best to get transcoding working using the default encoder first before trying to get accelerated transcoding to work. See this forum post for more detailed information regarding now to debug the hardware encoding:
How to verify which transcoder implementation is invoked
Note: When using Windows Remote Desktop the Quick Sync (Sandy Bridge) acceleration may not be available.
Note: When running Wowza Server on Windows as a system service you might be required to run the Wowza Media Server service as a named user for the NVidia CUDA transcoder to function properly.
Note: For details regarding the most recent Wowza Media Server 3 Preview release, see this forum post:
Wowza Media Server 3 Preview: Release Notes


Reply With Quote
