transcode integration guide
DESCRIPTION
Transcode Integration GuideTRANSCRIPT
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
MComms Transcode Integration Guide
Version: 3.7
Date: 1 December 2009
Contents
1 PRODUCT OVERVIEW ............................................................................................................. 2
2 STREAMING TO IPHONE ......................................................................................................... 2
2.1 FILE LAYOUT .................................................................................................................................. 2 2.2 INSTALLATION OF IPHONE PLAYLIST ASP SCRIPT IN IIS ............................................................... 3 2.3 INSTALLATION OF IPHONE PLAYLIST ASPX SCRIPT IN IIS 7 ......................................................... 5 2.4 INSTALLATION OF IPHONE PLAYLIST PHP SCRIPT IN APACHE ...................................................... 6 2.5 FINALISE CONFIGURATION ............................................................................................................. 7
3 3GPP MOBILE STREAMING IMPLEMENTATIONS .............................................................. 8
3.1 OUTPUT TO DARWIN/QUICKTIME OR REAL HELIX SERVERS ........................................................ 8 3.2 PACKETVIDEO SERVER ............................................................................................................... 10
4 WINDOWS MEDIA STREAMING ........................................................................................... 12
4.1 OUTPUT TO WINDOWS MEDIA SERVER ....................................................................................... 12 4.2 INPUT FROM WINDOWS MEDIA STREAM ...................................................................................... 14
5 WOWZA MEDIA SERVER ...................................................................................................... 14
6 HIGH AVAILABILITY AND REDUNDANCY ......................................................................... 15
6.1 INPUT REDUNDANCY .................................................................................................................... 15 6.2 SERVER CLUSTERING .................................................................................................................. 15 6.3 OUTPUT REDUNDANCY................................................................................................................. 16
7 GLOSSARY .............................................................................................................................. 17
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
1 Product Overview MComms Transcode software takes live a VoD video in many formats and encodes it for Mobile TV, web and IPTV streaming.
The output from MComms Transcode can be integrated with many different servers in order to service a wide range of end user devices. Typically Windows Media Server (free with Windows server editions) is used to stream Windows Media files and streams to PCs and smartphones. Darwin, pvServer, Sun Streaming Server, Vidiator and Real Server are used to stream 3GPP streams to mobile phones. Apache or IIS web servers are typically used to stream to iPhone and iPod touch.
2 Streaming to iPhone MComms Transcode works as the encoder and stream segmenter for streaming to iPhone.
Figure 1 – MComms Transcode system configuration
MComms Transcode outputs MPEG Transport Stream files suitable for playback on iPhone OS 3.0, each file is approximately the length of the Video Keyframe Interval which should be set to 10 seconds.
These files can be streamed using most popular web servers such as IIS and Apache, a different configuration method is required for each server as detailed below.
2.1 File Layout
MComms Transcode should be configured so that each output is set to save .ts files to a different directory. Normally the directory is named according to the channel name and also the bitrate of each output. E.g. c:/iphone/channel_1/60k/media.ts
If the web server is running on a different server to MComms Transcode, then the files should be stored temporarily on the local server and MComms Transcode configured to FTP the files to multiple remote servers.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
Figure 2 – Typical directory layout for iPhone files
A HTML file is supplied that contains either an <object> or <video> tags embed video players within a web page. The HTML page can be styled using any elements compatible with the iPhone and multiple video players can be embedded in a single page.
When the iPhone loads a html page with <object> or <video> or <a href> tags containing a link to a .m3u8 file, the iPhone will load the .m3u8 file to find out the contents of the playlist.
The .m3u8 file linked to the HTML page can either be an index file (which is a list of URLs to multiple bitrate playlists of the same stream), or it can be an actual playlist (containing URLs to .TS files).
2.2 Installation of iPhone playlist ASP script in IIS
TranscodeiPhone.m3u8 is an ASP script that will run on Microsoft IIS web server.
In order for a playlist file to be recognised by the iPhone, it must have a m3u8 extension. This is why the Transcode iPhone script has an .m3u8 extensions, instead of an .asp extenstion. Otherwise, TranscodeiPhone.m3u8 is a normal .asp file.
Once you have configured Transcode to generate iPhone compatible output files you will need to copy TranscodeiPhone.m3u8 and TranscodeiPhone.html to the same directory that you have configured Transcode to write the iPhone streaming files to. Of course, this must be a directory that is served by your IIS web server.
By default, IIS serves up .m3u8 files without processing them. Since TranscodeiPhone.m3u8 is actually an .asp file, we need to modify IIS's Application Extensions configuration.
/ base directory
HTML file
M3U8 multirate index file
Bitrate 1 folder
M3U8 playlist file
Media00001.ts to Media0000x.ts files
Bitrate 2 folder
M3U8 playlist file
Media00001.ts to Media0000x.ts files
Bitrate n folder
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
From Internet Information Services (IIS) Manager do the following:
Right click the website serving the iPhone stream and select Properties
Select the Home Directory tab in the properties dialog
Click the Configuration button
In the Application Configuration, select the Mappings tab and click Add...
In the Executable text box, enter: C:\WINDOWS\system32\inetsrv\asp.dll
In the Extenstion text box, enter .m3u8
Leave all other settings and click OK
Click OK on the Application Configuration dialog, and OK again on the web site properties dialog
Now you need to change some MIME types so that IIS can serve up the iPhone stream:
Right click the website serving the iPhone stream and select Properties
Select the HTTP Headers tab and click the MIME Types... button
In the MIME Types dialog, click New...
In the Extension textbox, enter .ts
In the MIME Type textbox, enter video/MP2T
Ensure that you have ASP scripting allowed, this will result in 404 errors if not correctly configured:
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
2.3 Installation of iPhone playlist ASPX script in IIS 7
Please note that the above ASP script will still run in IIS7 and is preferred to the ASPX script for simplicity. The ASPX script will also run on IIS 5/6, but is more difficult to configure.
The above process should be followed, keeping in mind the extension is now .aspx.
The additional step required is the following code should be added to machine.config in the
directory: c:\Winnt\Microsoft .NET\framework\<version>
<httpHandlers>
<add verb="*" path="*.m3u8" type="System.Web.UI.PageHandlerFactory" />
</httpHandlers>
2.3.1 Setting up IIS 7
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
2.4 Installation of iPhone playlist PHP script in Apache
Live streaming using Apache requires the use of PHP to generate playlists dynamically. As the iPhone OS version 3.0 only checks the file extension of .m3u8 files, it is necessary to use an Apache (mod_rewrite) to perform URL rewriting. URL rewriting works by changing URLs ending in .m3u8 to .php on the server so the iPhone OS 3.0 requests a .m3u8 URL but the Apache server processes the request as a .php file.
Please ensure that PHP 4 or 5 is installed prior to installing this
script, you can check this by loading version.php in a browser.
Place the supplied .htaccess file in the root directory of the web server, for Apache this is usually named "htdocs". If there is already a .htaccess file, then append the text to the existing file.
A change to MIME types doesn't seem to be required for Apache and the iPhone ignores them in OS 3.0, this may change in OS 3.1.
2.4.1 Enable Mod_Rewrite
Apache must have a module called mod_rewrite enabled in order to map URLs ending in .m3u8 to the correct PHP script
To do this open the “httpd.conf” file in the apache\conf directory and remove the hash # from all lines that contain “mod_rewrite”.
LoadModule rewrite_module modules/mod_rewrite.so
2.4.2 Test PHP Playlist
If you put the “MCommsiPhonePlaylist.php” file in a directory with .TS files. Use a PC browser (IE, Firefox etc) with the URL of the .php file
http://server/iphone/MCommsiPhonePlaylist.php
IE or FireFox will ask you to save the file, you should see a m3u8 playlist with lines starting with hash #.
If you instead see the php script source code, then you need to check your php file, URL and php installation.
2.4.3 URL Rewriting
Ensure that the “.htaccess” file supplied has been copied or merged to the root directory of the website.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
Use the same URL as above in a PC browser, except modify the extension to .m3u8
http://server/iphone/MCommsiPhonePlaylist.m3u8
In IE or Firefox you should see the same playlist with lines starting with hash #, you should also see a list of .TS files in ascending order.
If you receive an error or URL not found, you need to check that the “.htaccess” file supplied by MComms is correctly located in the root directory of the website.
If you receive Error 500, check that Apache has mod_rewrite installed.
2.4.4 Single Bitrate Test
Load the html URL on the iPhone and make sure that the media player icon displays correctly and shows WITHOUT a cross through it.
If the icon displays with a cross through it, then the php/m3u8 URL above is not working. Check that the HTML code has the correct relative path to the php/m3u8 URL
The HTML code can have a link to the php generated playlist or the playlist index with multiple bitrates, for a simple test use only one bitrate and adjust the link to the MCommsiPhonePlaylist.m3u8 file.
Click the icon and the media player should open.
2.4.5 Multiple bitrates
Change the HTML source to point to the playlist index file “MCommsiPhoneIndex.m3u8”, make sure that the relative paths are correct.
The “MCommsiPhoneIndex.m3u8” file should contain links to all the php “MCommsiPhonePlaylist.m3u8” files.
2.5 Finalise Configuration
Please note that the iPhone cannot directly use .m3u8 playlist files. Instead, get your iPhone to load the TranscodeiPhone.html file, which should be in the same directory as the
MCommsiPhoneIndex.m3u8 file.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
3 3GPP Mobile Streaming Implementations MComms Transcode can output RTP streams to all 3GPP compliant streaming servers, normally it is necessary to copy the SDP file that MComms Transcode generates to the streaming server. This is not necessary for multicast outputs as the SDP file is broadcast in SAP messages.
MComms Transcode will create a SDP file whenever an output starts, this file tells the streaming server how to receive the RTP stream.
Server Default SDP File Location
Default URL
Darwin C:\Program Files\Darwin
Streaming Server\Movies
rtsp://127.0.0.1/YourFileName
.sdp
Helix Server
C:\Program
Files\Real\Helix
Server\Content\rtpencoders
dp\YourFileName.sdp
rtsp://127.0.0.1/rtpencoder/Y
ourFileName.sdp
PacketVideo Server
/opt/pvns/content/public rtsp://192.168.0.1/public/You
rFileName.sdp
3.1 Output to Darwin/Quicktime or Real Helix Servers
MComms Transcode supports up to 16 outputs, each output can be delivered to a different streaming server. To stream to 3GPP mobile phones set the video compression to one of (H.263, MPEG4, H.264 and the audio compression to one of (AMR-NB or AAC/3GPP/LATM).
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
3G
Network
Packet Switched Streaming
Video Call
Encoder
Streaming
Servers
Video Gateway
MComms Monitor
Mcomms
Transcode
Proxy
Figure 3 - Output to Streaming Servers
If using Darwin server 5.5.1 to 5.5.5 there is no configuration necessary on the server itself other than to save the SDP file in the correct directory.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
3.2 PacketVideo Server
PacketVideo Server or pvServer sets up an RTSP connection from the pvServer to MComms Transcode. pvServer can be configured to receive multicast RTP streams (which is the preferred option) or to initiate the stream by connecting to MComms Transcode using RTSP.
3.2.1 RTP Multicast - Push
Configure one or more of the outputs of MComms Transcode to output to a multicast IP address e.g. 234.5.5.5. Copy the SDP file to the pvServer or put ftp commands in the OutStart.bat script.
Run the following commands on the pvServer:
cd /opt/pvns/tools/bin
./aliasServiceClient.ksh -h 127.0.0.1 -p 10000 -am
/public/live -sn multicastLive -si 192.168.126.1
./upstreamSessionMgmt.ksh -h 127.0.0.1 -p 10000 -startm -f
sdpFile.sdp
3.2.2 PVServer RTSP Request - Pull
PVServer is configured to initiate the encoding process by initiating a RTSP request to MComms Transcode and then MComms Transcode starts an output and delivers the stream to PVServer.
The URL to configure in PVServer to connect to MComms Transcode is in the form:
rtsp://<ip address>:port/sdpfilename.ext
<ip address> is the IP address of the MComms Transcode server, note that MComms Transcode listens on all interfaces
Port is the TCP port number, a different port number is used for each “Channel” tab in MComms Transcode. The port assigned is 554 + channel number. I.e. Channel 1 is port 555, Channel 2 is port 556, Channel 16 is port 570
sdpfilename.ext is any text configured in the SDP File box of the SDP File tab in MComms Transcode output settings.
MComms Transcode must be configured to wait for the PVServer to connect before starting the output, this is done by unticking the “Stream Enabled” check box as shown below:
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
In some cases you may want to configure multiple PVServers to connect to the same URL for scalability and redundancy. For PVServers initiating outputs using RTSP, each PVServer must be handled by a different output. However multiple outputs can be configured with the same settings and same “sdpfilename”, MComms Transcode will choose the first available output that matches the URL.
This is done by configuring a group of outputs with the same settings and then setting the SDP file of each output to the same name without a file path as shown below:
If the pvServer is configured to ask for a URL without a filename or directory (i.e. rtsp://1.2.3.4:555/), then any non-running outputs will be used.
The settings under the Audio and Video tabs should be configured to the desired codecs etc before the PVServer connects.
Under the RTP tab, the Stream Name may be configured but the server IP address and RTP port can be ignored.
On the PVServer run the following commands to initiate a stream on Channel 1:
cd /opt/pvns/tools/bin
./aliasServiceClient.ksh -h 127.0.0.1 -p 10000 -au
/public/live -c rtsp://192.168.126.1:555/sdpname
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
./upstreamSessionMgmt.ksh -h 127.0.0.1 -p 10000 -startu -cid
rtsp://192.168.126.1:555/sdpname
To Remove Streams:
./upstreamSessionMgmt.ksh -h 127.0.0.1 -p 10000 -stopu -cid
rtsp://192.168.126.1:555/sdpname
Remove a specific alias
./aliasServiceClient.ksh -h 127.0.0.1 -p 10000 -da
/public/live
Remove all aliases
./aliasServiceClient.ksh -h 127.0.0.1 -p 10000 -ca
3.2.3 Check Stream Status
On the pvServer run the following commands to initiate the stream
cd /opt/pvns/tools/bin
./aliasServiceClient.ksh -h 127.0.0.1 -p 10000 -ga
./upstreamSessionStatus.ksh -h 127.0.0.1 -p 10000 -su
4 Windows Media Streaming
4.1 Output to Windows Media Server
MComms Transcode can be set up to output to multiple Windows Media Servers. The connection between MComms Transcode and Windows Media Server is always HTTP but it can be initiated by WM Server (PULL) or by MComms Transcode (PUSH).
Click Output Settings, select Windows Media Stream as the Output Type.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
The audio and video codec settings should be configured as required, be sure to select a type of Windows Media codec for both (WM Server cannot support other codecs).
Take note to set the Video codec buffer length, as this will affect the time that the end client buffers the stream for before starting to play.
Set the WMSink to either Push or Pull to match the Windows Media Server configuration.
On the Windows Media Server, create a new publishing point using the Wizard:
Select “Encoder (a live stream).
Make sure that the IP address configured in the WM Server matches the MComms Transcode IP and configured Port number ie.
http://192.168.1.40:8089
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
Test the stream by using Windows Media Player to stream from the WM Server in either MMS, HTTP or RTSP protocols.
Note: that if you haven’t configured the Windows Media Server, you can also use Windows Media Player to stream directly from MComms Transode over http – in this case configure MComms Transcode not to push to the server.
4.2 Input from Windows Media Stream
The inputs of MComms Transcode can be connected to a Windows Media stream. HTTP, RTSP and MMS protocols are supported however the MMS protocol is often the easiest to implement because this protocol is not used for any other purpose.
Mcomms
TranscodeWindows
Media
Server
HTTP/RTSP/MMS
Media
Mobile
Streaming
Server
MobileAudio/Video
Source
Figure 4 - Windows Media Server
5 Wowza Media Server Wowza Media Server can receive RTP or MPEG Transport streams from MComms Transcode, and convert these to Flash and other transport formats.
When using Wowza Media server with MComms Transcode with RTSP outputs there are three steps that must be done. The first step is the server address of the RTSP output in MComms Transcode must point to the server address of the Wowza Media server.
The second step is to place the SDP file in the specified content directory of your Wowza media server. By default this directory is
<Wowza installation directory>\content. Finally the
video encoder type must be set to H264. Other than these three steps the output may be configured as you wish.
If you are streaming mpeg transport streams from MComms Transcode then it depends on whether the stream is unicast or multicast to how the stream should be configured. If the stream is unicast then stream must be sent to the server running Wowza Media Server. For a multicast stream the Wowza Media server must be on a network that is able to receive the multicast.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
6 High Availability and Redundancy MComms Transcode supports full redundancy at the inputs (with redundant inputs), server failover and multiple outputs. Multiple levels of redundancy can be designed depending on the desired level of availability.
6.1 Input Redundancy
MComms Transcode supports 2 content inputs and a background image for input redundancy. Normally input number 2 is played out to all the outputs, if the buffer of input 2 runs out then input number 1 will be shown at all the outputs. If the buffer of input 1 and 2 is empty then the background image will be shown at the outputs.
The input buffer time can be changed by clicking Tools/Options.
Click the Advnced tab:
Changes should only be made to the Optimal buffer time and the Start buffer time. The Optimal Buffer time can be anywhere from 2 seconds to 20 seconds depending on the input source (shorter for high stability, low jitter local source, longer for distant high jitter sources). Set the Start when buffered time to approximately half of the buffer time.
6.2 Server Clustering
Windows 2003 Server Enterprise and Datacentre editions support clustering, please view the Microsoft guide on how to set this up:
http://www.microsoft.com/windowsserver2003/enterprise/clustering.mspx
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
6.3 Output redundancy
Output redundancy can also be achieved when using Helix Server or another server that supports redundant streams.
Figure 5 – High Availability
When the encoders connect to Helix Mobile Server the SDP files must be saved with a number after their name. Consider this example:
live.sdp.2 connects first
live.sdp.3 connects second
live.sdp.1 connects third
Under normal circumstances all media players receive the stream live.sdp, and have no knowledge of the encoder sending the stream. In the preceding example, live.sdp originates as live. sdp.2. If the encoder delivering live.sdp.2 fails, media players reconnect to the next live. sdp stream in the queue, which is live. sdp.3. If live. sdp.2 returns, it goes to the bottom of the queue. A subsequent failure of live. sdp.3 causes media players to connect to live. sdp.1, and so on.
If an encoder fails, then the media player must stop and reconnect to the stream. Helix Mobile Server can take up to 30 seconds to recognise an encoder has failed.
MComms TV
ABN 73 118 968 988
Level 1, William Street | Melbourne Vic 3000 | Australia
www.mcommstv.com
7 Glossary 3GPP Third Generation Partnership Project
AAC Advanced Audio Coding
AMR Adaptive Multirate Codec
DRM Digital Rights Management
GUI Graphical User Interface
HA High Availability
IP Internet Protocol
Kbps KiloBits per second
Mbps MegaBits per second
MIB Management Information Base
M-JPEG Motion JPEG
MPEG Moving Picture Experts Group
O&M Operation and Maintenance
QCIF Quarter CIF resolution (176 x 144 pixels)
QVGA Quarter VGA resolution (320 x 240 pixels)
RDT RealNetworks Data Transport
RTCP RTP Control Protocol
RTP Real-Time Transport Protocol
RTSP Real-Time Streaming Protocol
SDP Session Description Protocol
SNMP Simple Network Management Protocol
UMTS Universal Mobile Telecommunications System
URI Uniform Resource Identifier
URL Uniform Resource Locator
WCDMA Wideband Code Division Multiple Access