Stream live media (RTMP)

Tutorial: stream live media (RTMP)

To complete this tutorial, install the following software:

  • Flash Media Live Encoder

    Flash Media Live Encoder captures live audio and video, encodes it, and streams it to Adobe Media Server. Flash Media Live Encoder is free so it’s a good idea to download the latest version.

  • Adobe Media Server

    You can use any edition of Adobe Media Server to stream live media, including the free developer edition. For information about installing the server, see Installing the server.

  • Flash Player

    This tutorial uses a video player that requires Flash Player 10.

For more information, see Supported clients, encoders, codecs, and file formats and Pre-built media players.

Publish a live stream to Adobe Media Server

  1. Connect a camera to the computer.

  2. Open Flash Media Live Encoder and do the following in the Encoding Options panel:

    1. From the Preset menu, choose High Bandwidth (300 Kbps) - H.264.

      You can choose any of the single stream options (not Multi Bitrate) from the Preset menu. The information on the left side of the panel is filled in when you choose a preset.

    2. Select Stream to Adobe Media Server.

    3. For AMS URL, enter rtmp://localhost/live.

      Use localhost for testing when Flash Media Live Encoder and Adobe Media Server are on the same computer. In a production environment, use the domain name or IP address of the computer hosting Adobe Media Server, for example, rtmp://ams.mycompany.com/live.

      If you’re using a Adobe Media Server hosting provider, they can give you the domain name or IP address of the server.

      You must use the name live in the AMS URL unless you duplicate and rename the live service. The live service is a pre-built application on Adobe Media Server installed to rootinstall/applications/live. For more information, see Duplicate the live service.

    4. For Stream, enter livestream.

    5. To save a recording of the stream on your hard drive, select Save to File, click Browse, and choose a location. If you chose an H.264 preset, use an .f4v filename extension. If you chose a VP6 preset, use an .flv filename extension.

      Note that the server is not recording the file; Flash Media Live Encoder is recording the file. To serve the file on-demand when the live event is over, copy the file to the local disk of the server. For more information, see Stream on-demand media (RTMP).

      To play an F4V file recorded by Flash Media Live Encoder without streaming it from the server, use the F4V Flattener tool to flatten the file. You can play FLV files without flattening them.

    6. Click Start to connect to the server and start streaming.

Use the Adobe Media Server sample player to play a live stream

  1. Double-click the rootinstall/samples/videoPlayer/videoplayer.html file to open the sample video player in a browser.

    Note: Substitute the Adobe Media Server installation directory for rootinstall.
  2. In the sample video player, do one of the following:

    • In the list of videos, click “livestream”.

    • Enter rtmp://localhost/live/livestream, check the LIVE checkbox, and click PLAY STREAM.

      If the media player isn’t on the same computer as Adobe Media Server, replace localhost with the domain name or IP address of the computer hosting Adobe Media Server.

      Use this URL to play this stream from any compatible video player, including Flash Media Playback and Strobe Media Playback. For more information about the sample video player and other video players, see Pre-built media players.

Use Flash Media Playback to play a live stream

  1. Load the Flash Media Playback Setup page in a web browser.

  2. Enter the Video Source:

    rtmp://localhost/live/livestream

    You can replace localhost with the domain name or IP address of the server.

  3. Click Preview to update the embed code.

  4. Click Play to test the code.

  5. To use the player in your own HTML page, copy the embed code and paste it into your page. Flash Media Playback is a compiled SWF file hosted by Adobe.

URLs for publishing and playing live streams over RTMP

Use the following values to publish a single live stream to Adobe Media Server for streaming over RTMP:

AMS URL: rtmp://ams-ip-or-dns/live

Stream: streamname

Use the following URL to play a live stream:

rtmp://ams-ip-or-dns/live/streamname

Duplicate the live service

You can create as many instances of the live service as you need.

  1. Create a folder in the rootinstall/applications folder, for example, rootinstall/applications/live2

  2. Copy the main.far, Application.xml, allowedHTMLdomains.txt, and allowedSWFdomains.txt files from the rootinstall/applications/live folder to the live2 folder.

  3. Open the ams.ini file (located in rootinstall/conf) and add a parameter to set the content path for the new service, for example:
    LIVE2_DIR = C:\Program Files\Adobe\Adobe Media Server 5\applications\live2
  4. Open the Application.xml file in the rootinstall/applications/live2 folder and edit the virtual directory to the following:

    <Streams>/;${LIVE2_DIR}</Streams>
  5. Restart the server.

  6. Clients can connect to the new publishing point at the URL:

    rtmp://ams-ip-or-dns/live2 

Modify server-side code in the live service

Note: You cannot modify server-side code in the live service on Adobe Media Server Standard.

 Remove the rootinstall/applications/live/main.far file and replace it with the rootinstall/samples/applications/live/main.asc file.

Disable live services

 Move any live services folders out of the applications folder.