• How to publish and play a live stream (MPEG-TS based encoder)

    This tutorial provides the basic steps for using a live encoder that publishes a stream using the MPEG-2 Transport Stream (MPEG-TS) protocol to stream live content to Adobe® Flash® Player, Microsoft® Silverlight® player, Apple® iOS devices, and RTSP/RTP based-players.

    Contents



    Tutorial


    Troubleshooting


    Related Articles

    Tutorial



    Configuration


    This section provides the basic steps for setting up an application for live streaming and configuring Application.xml.

    1. Create application folder [install-dir]/applications/live.

    2. Create configuration folder [install-dir]/conf/live and copy [install-dir]/conf/Application.xml to this new folder.

    3. Edit the newly copied Application.xml file and make the following changes (some of these settings may already be present):

      Note: Right-click HERE to download a pre-configured version of Application.xml.

      1. Set the Streams/StreamType property to:
        Code:
        <StreamType>live</StreamType>
      2. Set the HTTPStreamers property to:
        Code:
        <HTTPStreamers>cupertinostreaming,smoothstreaming,sanjosestreaming</HTTPStreamers>
      3. Set the Streams/LiveStreamPacketizers property to:
        Code:
        <LiveStreamPacketizers>cupertinostreamingpacketizer,smoothstreamingpacketizer,sanjosestreamingpacketizer</LiveStreamPacketizers>
      4. Set the RTP/Authentication/PlayMethod property to:
        Code:
        <PlayMethod>none</PlayMethod>


    Publishing the stream


    This section provides the basic steps for creating a .stream file to publish your live stream to Wowza Media Server.

    1. Consult your MPEG-TS encoder documentation to configure an outgoing live stream. Publish the stream to the IP address of the server running Wowza Media Server using port 10000.

    2. Create .stream file:

      1. Use a text editor to create the file [install-dir]/content/mpegts.stream and set the contents of this file to udp://0.0.0.0:10000. If you're receiving a multicast stream, change the 0.0.0.0 part of the URL to the multicast address of the stream.

      2. Using a text editor, edit the [install-dir]/conf/admin.password file and add a username and password that will be used to start and stop the publishing of the MPEG-TS stream (below is an example of the file with the username myuser and password mypassword):
        Code:
        # Admin password file (format [username][space][password])
        # username password
        myuser mypassword
    3. Start Wowza Media Server.

    4. Use Stream Manager to start the MPEG-TS stream:

      1. Enter the following URL in a web browser:
        URL: http://[wowza-ip-address]:8086/streammanager

      2. In the Security dialog box, enter your admin username and password from above.

      3. In the Stream Manager webpage, click the [start-receiving-stream] link just below the live application folder.

      4. In the Start Receiving Stream dialog box, select the following MediaCaster Type option: rtp

      5. In the Stream Name field, enter mpegts.stream.

      6. Click OK.

    Playback


    Note: In the following examples, [wowza-ip-address] is the IP address or domain name of the server running Wowza Media Server.

    Adobe Flash Player (RTMP)


    In Wowza Media Server 3.5, double-click [install-dir]/examples/LiveVideoStreaming/FlashRTMPPlayer/player.html, enter the information below, and then click the Connect button.

    Server: rtmp://[wowza-ip-address]/live
    Stream: mpegts.stream

    To play the stream from a remote computer, copy the FlashRTMPPlayer folder to a web server, and then connect to: http://<webserver>/FlashRTMPPlayer/player.html.

    Note: In Wowza Media Server 3.1.2 and earlier, double-click [install-dir]/examples/LiveVideoStreaming/client/live.html, enter the information below, and then click the Play button.

    Server: rtmp://[wowza-ip-address]/live
    Stream: mpegts.stream

    To play the stream from a remote computer, copy the client folder to a web server, and then connect to: http://<webserver>/client/live.html.

    Note: If your application will only stream to Flash RTMP clients, see Flash RTMP clients only.

    Adobe Flash Player (San Jose/Adobe HDS)


    In Wowza Media Server 3.5, double-click [install-dir]/examples/LiveVideoStreaming/FlashHTTPPlayer/player.html, enter the information below, and then click the Connect button.

    Stream: http://[wowza-ip-address]:1935/live/mpegts.stream/manifest.f4m

    To play the stream from a remote computer, copy the FlashHTTPPlayer folder to a web server, and then connect to: http://<webserver>/FlashHTTPPlayer/player.html.

    Note: In Wowza Media Server 3.1.2 and earlier, double-click [install-dir]/examples/LiveVideoStreaming/clientOSMF/bin-release/LiveOSMFPlayer.html, enter the information below, and then click the Play button.

    Stream: http://[wowza-ip-address]:1935/live/mpegts.stream/manifest.f4m

    To play the stream from a remote computer, copy the clientOSMF/bin-release folder to a web server, and then connect to: http://<webserver>/bin-release/LiveOSMFPlayer.html.

    Note: The stream can only be played from an OSMF-based Flash player that's embedded in a webpage.

    Apple iOS device (Cupertino/Apple HLS)


    Enter the following URL into the Safari® web browser on the device:

    URL: http://[wowza-ip-address]:1935/live/mpegts.stream/playlist.m3u8

    Note: The Apple iPhone® 3GS (and older) and iPod touch® devices require that video be encoded using H.264 format (Baseline profile level 3 or lower) and AAC or MP3 stereo audio. iPhone 3GS and newer devices support Baseline profile. For encoding guidance for playback on Apple iOS devices, see How to find Apple iOS device supported profile and level information.

    Note: This stream can also be played using the Safari web browser or QuickTime 10.x on a computer running Mac OS® X Snow Leopard version 10.6 and later.

    Microsoft Silverlight (Smooth Streaming)


    In Wowza Media Server 3.5, double-click [install-dir]/examples/LiveVideoStreaming/SilverlightPlayer/player.html, enter the information below, and then click the Connect button.

    Stream: http://[wowza-ip-address]:1935/live/mpegts.stream/Manifest

    To play the stream from a remote computer, copy the SilverlightPlayer folder to a web server, and then connect to: http://<webserver>/SilverlightPlayer/player.html.

    Note: In Wowza Media Server 3.1.2 and earlier, double-click [install-dir]/examples/LiveVideoStreaming/clientSilverlight/Default.html, enter the information below, and then click the Play button.

    Stream: http://[wowza-ip-address]:1935/live/mpegts.stream/Manifest

    To play the stream from a remote computer, copy the clientSilverlight folder to a web server, and then connect to: http://<webserver>/clientSilverlight/Default.html

    Note: The Silverlight player requires that both audio and video be present for playback. For live streaming only, the key frame frequency (which can be set directly in some encoders or is gop/fps) must be between 1 and 4 seconds (2 seconds is recommended). Anything greater than 4 seconds may cause playback to freeze.

    RTSP/RTP player


    Enter the following URL into the RTSP/RTP player:

    URL: rtsp://[wowza-ip-address]:1935/live/mpegts.stream

    Adaptive Bitrate Streaming


    Adaptive bitrate (ABR) live streaming to Adobe® Flash® Player, Apple iOS devices, and Microsoft Silverlight requires that you have an encoder that can generate multiple bitrate streams from the same source with properly aligned key frames. You also must create a Synchronized Multimedia Integration Language (SMIL) file that links the streams together for playback.

    For example, let's say that we have three live streams encoded at different bitrates:

    • mpegts_700.stream (700kbps total bitrate)
    • mpegts_350.stream (350kbps total bitrate)
    • mpegts_200.stream (200kbps total bitrate)

    Using a text editor, create a SMIL file named mpegts.smil in the [install-dir]/content folder with the following content:
    Code:
    <smil>
        <head>
        </head>
        <body>
            <switch>
                <video src="mpegts_700.stream" system-bitrate="700000"/>
                <video src="mpegts_350.stream" system-bitrate="350000"/>
                <video src="mpegts_200.stream" system-bitrate="200000"/>
            </switch>
        </body>
    </smil>
    You can see that there's a <video> entry in the <switch> container for each stream rendition. The system-bitrate value is set to the total bitrate (in bits-per-second) for that stream.

    Microsoft Smooth Streaming will only switch between the video portion of the streams. The audio track in the first stream listed in the <switch> container will be used. If you want to use a stream other than the first stream for the audio track, add an <audio> entry to the <switch> container for that item. For example:
    Code:
    <smil>
        <head>
        </head>
        <body>
            <switch>
                <video src="mpegts_700.sdp" system-bitrate="700000"/>
                <video src="mpegts_350.sdp" system-bitrate="350000"/>
                <video src="mpegts_200.sdp" system-bitrate="200000"/>
                <audio src="mpegts_200.sdp" system-bitrate="96000"/>
            </switch>
        </body>
    </smil>
    Note: The <audio> item will be ignored when streaming using Adobe HDS (San Jose) or Apple HLS (Cupertino) streaming.

    Adobe Flash Player (San Jose/Adobe HDS)


    In Wowza Media Server 3.5, double-click [install-dir]/examples/LiveVideoStreaming/FlashHTTPPlayer/player.html, enter the information below, and then click the Connect button.

    Stream: http://[wowza-ip-address]:1935/live/smil:mpegts.smil/manifest.f4m

    Note: In Wowza Media Server 3.1.2 and earlier, double-click [install-dir]/examples/LiveVideoStreaming/clientOSMF/bin-release/LiveOSMFPlayer.html, enter the information below, and then click the Play button.

    Stream: http://[wowza-ip-address]:1935/live/smil:mpegts.smil/manifest.f4m

    Apple iOS device (Cupertino/Apple HLS)


    Enter the following URL into the Safari web browser on the device:

    URL: http://[wowza-ip-address]:1935/live/smil:mpegts.smil/playlist.m3u8

    Microsoft Silverlight (Smooth Streaming)


    In Wowza Media Server 3.5, double-click [install-dir]/examples/LiveVideoStreaming/SilverlightPlayer/player.html, enter the information below, and then click the Connect button.

    Stream: http://[wowza-ip-address]:1935/live/smil:mpegts.smil/Manifest

    Note: In Wowza Media Server 3.1.2, double-click [install-dir]/examples/LiveVideoStreaming/clientSilverlight/Default.html, enter the information below, and then click the Play button.

    Stream: http://[wowza-ip-address]:1935/live/smil:mpegts.smil/Manifest

    By default Microsoft Smooth Streaming will calculate video and audio bitrates for the manifest data on-the-fly by inspecting the stream. If you want to configure Wowza Media Server to use the bitrates in the SMIL file, add the following property to the HTTPStreamer/Properties container in [install-dir]/conf/[application]/Application.xml (be sure to get the correct Properties container - there are several in the Application.xml file):
    Code:
    <Property>
        <Name>smoothStreamingUseSMILBitrates</Name>
        <Value>true</Value>
        <Type>Boolean</Type>
    </Property>
    When running in this mode, Wowza Media Server will assume that the video and audio system-bitrate values are for the video and audio data only.

    Adobe Flash Player (RTMP)


    Dynamic streaming for Adobe Flash requires a fair amount of work on the client-side. The following articles provide details about how to achieve dynamic streaming in Flash:

    Dynamic streaming in Flash (part 1)
    Dynamic streaming in Flash (part 2)
    Dynamic streaming in Flash (part 3)

    When streaming using Adobe HTTP Dynamic Streaming (Adobe HDS) with Wowza Media Server, it's best to turn on dynamic stream markers, which will provide more accurate on-the-fly bitrate calculations (in most cases). To turn on dynamic stream markers, edit [install-dir]/conf/[application]/Application.xml and add the following property to the Streams/Properties container (be sure to get the correct Properties container - there are several in the Application.xml file):
    Code:
    <Property>
        <Name>enableDynamicStreamMarkers</Name>
        <Value>true</Value>
        <Type>Boolean</Type>
    </Property>
    Note: Dynamic stream markers are turned on by default in Wowza Media Server 2.2.0 and later.

    Flash RTMP clients only


    (Optional) If your application will only stream to Flash RTMP clients, in [install-dir]/conf/live/Application.xml, you can set the Streams/StreamType property to:
    Code:
    <StreamType>rtp-live</StreamType>
    If you do this, then you won't need to use StreamManager (see Publishing the stream). The first Flash client that plays the stream will trigger Wowza Media Server to start re-streaming.

    Also, in [install-dir]/conf/live/Application.xml, make sure that the Streams/LiveStreamPacketizers property is empty:
    Code:
    <LiveStreamPacketizers></LiveStreamPacketizers>

    Troubleshooting



    RTSP/RTP


    • RTSP/RTP streaming is used to stream to Android™ and BlackBerry® mobile devices. Newer Android-based phones also support Adobe Flash Player 10.1 and later, along with RTMP and Adobe HTTP Dynamic Streaming (Adobe HDS).

    • To stream to RTSP/RTP, be sure that UDP ports 0-65535 are open and properly mapped to the server running Wowza Media Server.

    • It's very important to carefully follow the instructions provided in How to troubleshoot RTSP/RTP playback to properly configure Wowza Media Server for RTSP/RTP streaming.

    Common problems with .stream files


    • Many text editors will append a .txt filename extension to the mpegts.stream filename. This will result in an error message similar to the following:

      SDP file missing: c:/program files/wowzamediasystems/wowzamediaserver[version]/content/mpegts.stream

      To fix this, go to the [install-dir]/content folder and remove the .txt filename extension from the file.

    • The mpegts.stream file contains the address of the incoming UDP stream that carries the MPEG-TS packets. Most of the time, it's sufficient to set this address to the following:

      URL: udp://0.0.0.0:[port]

      Where [port] is the port number to which the stream is being published.

      The IP address (0.0.0.0) instructs Wowza Media Server to listen on all local IP addresses for the incoming stream. Sometimes this won't work properly if the computer has multiple network interfaces. If this happens, it's best to specify the internal IP address of the stream. For example, to listen to the local loopback interface, you might specify:

      URL: udp://127.0.0.1:10000

      Or you might specify the computer's internal NAT address:

      URL: udp://192.168.1.1:10000

    Properties to fix audio and video alignment


    Some MPEG-TS encoders publish video and audio where the media frames are not aligned on PES packet boundaries. This will cause the video and audio to not play. Wowza Media Server can re-align unaligned streams, but it requires a property to be added to [install-dir]/conf/[application]/Application.xml.

    To turn on the code to fix audio alignment, add the following property to the RTP/Properties container in [install-dir]/conf/[application]/Application.xml (be sure to get the correct <Properties> container - there are several in the Application.xml file):
    Code:
    <Property>
                    <Name>audioIsAligned</Name>
                    <Value>false</Value>
                    <Type>Boolean</Type>
    </Property>
    To turn on the code to fix video alignment, add the following property to the RTP/Properties container in [install-dir]/conf/[application]/Application.xml (be sure to get the correct <Properties> container - there are several in the Application.xml file) (Wowza Media Server 3 or greater is required):
    Code:
    <Property>
                    <Name>videoIsAligned</Name>
                    <Value>false</Value>
                    <Type>Boolean</Type>
    </Property>

    Property to fix TS packet alignment in UDP packets


    A few MPEG-TS encoders don't align TS packets correctly in UDP packets. When this happens, you'll see lots of the following warning messages in the logs:

    RTPDePacketizerMPEGTS.handleRTPPacket: Out of sync: 0x[nn]

    Add the following property to the RTP/Properties container in [install-dir]/conf/[application]/Application.xml (be sure to get the correct <Properties> container - there are several in the Application.xml file):
    Code:
    <Property>
        <Name>rtpDePacketizerWrapper</Name>
        <Value>com.wowza.wms.rtp.depacketizer.RTPDePacketizerWrapperReChunkMPEGTS</Value>
    </Property>
    Wowza Media Server only allows a single rtpDePacketizerWrapper value. If you have configured a jitter buffer or packet recorder that uses the same rtpDePacketizerWrapper, they must be removed.

    Property to force output to MPEG-TS (set-top box)


    When streaming out using RTSP/RTP, you can force the output to MPEG-TS (which is required by many set-top boxes) by adding the following properties to the RTP/Properties container in [install-dir]/conf/[application]/Application.xml (be sure to get the correct <Properties> container, there are several in the Application.xml file):
    Code:
    <Property>
        <Name>forceMPEGTSOut</Name>
        <Value>true</Value>
        <Type>Boolean</Type>
    </Property>
    <Property>
        <Name>rtpWrapMPEGTS</Name>
        <Value>true</Value>
        <Type>Boolean</Type>
    </Property>

    Property to change AAC packetization method


    Wowza Media Server can output AAC audio using the mpeg4-generic and mp4a-latm (3gpp) packetization methods. The default packetization method is mpeg4-generic. To switch to mp4a-latm (3gpp), add the following property to the RTP/Properties container in [install-dir]/[application]/Application.xml (be sure to get the correct <Properties> container, there are several in the Application.xml file):
    Code:
    <Property>
        <Name>audioPacketizerAAC</Name>
        <Value>com.wowza.wms.rtp.packetizer.RTPPacketizerMPEG4LATM</Value>
    </Property>


    Updated: For Wowza Media Server 3.5.0 on 11-08-2012
    Comments 26 Comments
    1. bmckim -
      This article forgets to tell you to publish the .smil file as a stream:


      Using either the Stream Manager, [install-dir]/conf/StartupStreams.xml or IApplicationInstance.startMediaCasterStream(...), start the stream using the stream name smil:[smil-file-name]. For example, to start the stream group above use the stream name smil:stream.smil. Once started, you can double check to be sure the stream is started as a group by viewing the streams in the Stream Manager. Stream groups will be listed under each of the individual streams.
    1. rrlanham -
      I don't think it is ever necessary to start a smil file with MediaCaster, just the items in the smil, if they are MediaCaster streams.

      Richard
    1. lisa_w -
      Added note with required parameters for playback with Microsoft Silverlight (Smooth Streaming). -Lisa
    1. apakabartv -
      I have a couple of questions.

      1) any idea why we have to login to port 8086 in order to start receiving mpegts stream ?

      2) can the above "live" and "rtp-live" stream types coexist at the same time ? I can have the rtp-live stream type above to work, but not the live.
    1. rrlanham -
      If you don't want to login to StreamManager, open /conf/VHost.xml and search for
      Code:
      com.wowza.wms.http.streammanager.HTTPStreamManager
      , then change the AuthenticationMethod in that HTTProvider to "none", then restart Wowza. However, this is not a good idea for security reasons.

      You can have an application with StreamType "live" and publish (push) streams to that application, then start other MediaCaster (pull) streams with the StreamManager, and they can all co-exists, no problem.

      Richard
    1. apakabartv -
      Thank you very much.

      Actually what I wanted to ask was how to automatically start receiving live stream (i.e. without having the admin to login and click the "start receiving stream"). Your answer leads me to chapter 5 of Wowza user guide and I got what I want. Edit the StartupStreams.xml file and uncomment the <StartupStream> section for MPEG-TS.

      Cool ...
    1. countz -
      Can you have multiple entries in a .stream file?
    1. rrlanham -
      No, just one

      Richard
    1. countz -
      I have the below sample URL for iPad users, how do I make it redundant such that it will try more than one .stream file?

      http://test.com:1935/testRepeat/_def.../playlist.m3u8

      At the moment, if the source specified in test.stream is down, users get a "File not found" message.
    1. rrlanham -
      I can't think of an easy way to do that.

      Richard
    1. LearnerDev -
      So when transcoding with VLC which profile i should use?
    1. rrlanham -
      If you are streaming to mobile devices, Baseline 3 is recommended.

      More info:
      http://www.wowza.com/forums/content....erver-(MPEG-TS)

      Richard
    1. tunglq87 -
      Hi, all!

      I don't understand step 7 above how to.( Configure the MPEG-TS based encoder to send a live stream to the IP address of the server running Wowza Server using port 10000 ). everyone help me...!
    1. rrlanham -
      This article shows how to use StreamManager:

      http://www.wowza.com/forums/content....Stream-Manager

      Richard
    1. rrlanham -
      Sorry StreamManager is step 8.

      Step 7, configuring your encoder, is specific to whichever encoder you are using, but there should be a way to enter an IP address that you will point the stream at. Make that the IP address of your Wowza server.

      Richard
    1. tunglq87 -
      Thanks! Richiard !

      I understand! and i used encoder (vlc, wirecast) success. But, when i use encoder on windows. Now, Can i use encoder on Linux (CentOS 5.6 64 bit)? so, how to config them? ( my system is using Wowza media server 2 on CentOS 5.6 64 bit)
    1. rrlanham -
      The only mpegts encoder that I have experience with really is VLC:

      http://www.wowza.com/forums/content....erver-(MPEG-TS)

      Richard
    1. apakabartv -
      Hello,

      Any suggestion how I could secure the UDP port from unsolicited (trashing) stream?
      I mean, if Wowza listens to an incoming stream on a public IP, then once someone out there figures out the port number, he/she could send some bogus stream just to interfere with my own stream.

      One way that I have in mind is as follow:

      Put 2 network interface cards on the Wowza server. one is connected to the LAN (private IP), and one is connected to the internet (public IP). Wowza will only listen to incoming stream on the LAN interface.
      Then all of my live stream sources (e.g. IP camera, etc) will need to be on the LAN. This can be achieved by having VPN setup for my remote IP camera in order to get access to the LAN. I know that setting up a VPN access like this could be another big job.

      Is there any other suggestion in this topic ?

      Thanks in advance,
      William.
    1. charlie -
      There should be a way to do it using IP tables where you only allow a given IP address or address range to write UDP packets to a given port. I do not know the exact syntax.

      Charlie
    1. cnfcnf -
      Hi there,

      I am very confused. I am trying to transmit a live video from my webcam/tv tuner to my server running Wowza using VLC. I am not trying to transfer a fixed mp4 file.

      Can anyone tell me the VLC settings for this? I believe the Input source in this case should be a capture device. Am I correct about this?

      I am a bit confused on how I should "refer" to the capture device on the commandline. For instance, if I am using a webcam, what is the capture device name? Obviously I would need to specify 2 things: the capture device from where the video is to be taken, and the destination server on which wowza is running.

      Please help!