Tutorials: on-demand and live streaming

Important: When you terminate an instance, any changes you made to the instances and any content you copied to the instance are permanently deleted. Copy content from the instance to an S3 bucket or an EBS volume before you terminate the instance.

On-demand streaming

Flash Media Server on Amazon Web Services has a built-in vod application that streams video on demand content to video players running in Flash Player and AIR. These tutorials use video players built with the Open Source Media Framework (OSMF). OSMF simplifies the development of video players for the Flash Platform.

The first tutorial uses a video player called Flash Media Playback. Flash Media Playback is hosted by Adobe and you can embed it into any web page.

The second tutorial uses a video player called Strobe Media Playback. Host Strobe Media Playback on your own web server.

On-demand streaming with Flash Media Playback

  1. Log in to AWS Management Console and do one of the following:

  2. In the AWS Management Console, select the running instance and copy the Public DNS from the details pane.

  3. Do one of the following to copy an FLV or F4V/MPEG-4 file to the instance:

    • (Windows) See Connect to an instance and copy files from a Windows computer to use WinSCP to connect to the instance.

      In the left pane of WinSCP, browse to a video file on your local computer. In the right pane, browse to the /mnt/applications/vod/media directory on the remote instance. Drag the file from the left pane to the right pane.

      View full size graphic
      WinSCP graphical user interface. Local files are in the left pane. Files on the Flash Media Server instance are in the right pane.
    • (Linux) Open an SSH client installed on your computer and use the scp command to copy a file to the instance:

      scp -i keypair.pem sample.mp4 root@public-dns:/mnt/applications/vod/media

      For example, if the filename of the video is sample.mp4, the command is:

      scp -i fmsdocs.pem sample.mp4 root@ec2-184-72-148-15.compute-1.amazonaws.com:/mnt/applications/vod/media
      Note: Use the Key Pair file you downloaded when you created the instance.
      View full size graphic
      Copying a file from a local computer to an instance
      Note: Flash Media Server and Apache HTTP Server run as fmsuser:fmsgroup. You may need to modify the uploaded content to allow access to it.
  4. Go to the Flash Media Playback Setup page at http://www.osmf.org/configurator/fmp/ and do the following:

    1. For Video Source, enter:

      rtmp://public-dns/vod/filename

      For example, if the filename of the video is sample.mp4, and the Public DNS of the instance is ec2-184-72-148-15.compute-1.amazonaws.com, the Video Source is:

      rtmp://ec2-184-72-148-15.compute-1.amazonaws.com/vod/mp4:sample.mp4

      The following table shows how to create a URL based on the file format of the media.

      File format

      URL

      FLV

      rtmp://public-dns/vod/filename

      F4V

      rtmp://public-dns/vod/mp4:filename.f4v

      rtmp://public-dns/vod/mp4:subdirectory/filename.f4v

      MP4

      rtmp://public-dns/vod/mp4:filename.mp4

      rtmp://public-dns/vod/mp4:subdirectory/filename.mp4

      Note: For F4V/MPEG-4 files, always use the prefix mp4:, but use the file extension of the file (.f4v, .mp4, and so on).
    2. Click Preview to update the Embed Code.

    3. Click the Play button to play the video from your Flash Media Server on Amazon Web Services instance.

      View full size graphic
      Flash Media Playback Setup page. Copy and paste the Preview Embed Code into an HTML page to use the video player. The video player is hosted by Adobe.

    You can select other options in the Flash Media Playback Setup page. After you change an option, click Preview to update the embed code.

    To embed Flash Media Playback in your own web page, copy the Preview Embed Code, and paste it into your HTML page.

  5. When you terminate the instance, the data is deleted. To keep the recorded stream, copy it to a storage volume (S3 or EBS). For information about transferring files, see Managing content.

On-demand streaming with Strobe Media Playback

  1. Follow steps 1-3 of the “On-demand streaming with Flash Media Playback” tutorial.

  2. Download Strobe Media Playback.

  3. Open the file strobe_root_folder/10.1/StrobeMediaPlayback.html in a text or HTML editor.

  4. Locate the following URL:

    "http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv"

    Replace the URL with the URL of the file you copied to the instance and save the file. Use the following syntax:

    "rtmp://public-dns/vod/mp4:filename.mp4"

    File format

    URL

    FLV

    rtmp://public-dns/vod/filename

    F4V

    rtmp://public-dns/vod/mp4:filename.f4v

    rtmp://public-dns/vod/mp4:subdirectory/filename.f4v

    MP4

    rtmp://public-dns/vod/mp4:filename.mp4

    rtmp://public-dns/vod/mp4:subdirectory/filename.mp4

  5. Open the StrobeMediaPlayback.html file in a browser and click Play.

    The file streams from Flash Media Server on Amazon Web Services to the local version of Strobe Media Playback.

  6. You can also serve Strobe Media Playback and its supporting files from the Apache web server installed with Flash Media Server on Amazon Web Services. Copy the Strobe Media Playback files to the following directory:

    /mnt/webroot

    For example, create a folder /mnt/webroot/strobe. Copy the following files from the strobe_root_folder/10.1 folder to the /mnt/webroot/strobe folder:

    StrobeMediaPlayback.html, StrobeMediaPlayback.swf, the images folder, the scripts folder, and the playlists folder.

    Load the following URL into a browser and click play:

    http://public-dns/strobe/StrobeMediaPlayback.html

  7. When you terminate the instance, the data is deleted. To keep the recorded stream, copy it to a storage volume (S3 or EBS). For information about transferring files, see Managing content.

Live streaming

Flash Media Server on Amazon Web Services has a built-in live application that streams live content to video players running in Flash Player and AIR. These tutorials use video players built with the Open Source Media Framework (OSMF). OSMF simplifies the development of video players for the Flash Platform.

The first tutorial uses a video player called Flash Media Playback. Flash Media Playback is hosted by Adobe and you can embed it into any web page.

The second tutorial uses a video player called Strobe Media Playback. Host Strobe Media Playback on your own web server.

Live streaming with Flash Media Playback

  1. Log in to AWS Management Console and do one of the following:

  2. In the AWS Management Console, select the running instance and copy the Public DNS from the details pane.

  3. Open Flash Media Live Encoder and enter the following:

    • For FMS URL, enter:

      rtmp://public-dns/live

      Substitute the Public DNS value you copied from the AWS Management Console.

    • For Stream, enter:

      livestream

    • Click Start to publish a stream to the live application on the instance.

    View full size graphic
    Flash Media Live Encoder.
  4. Go to the Flash Media Playback Setup page at http://www.osmf.org/configurator/fmp/ and do the following:

    1. For Video Source, enter:

      rtmp://public-dns/live/livestream

      For example, if the Public DNS of the instance is ec2-184-72-148-15.compute-1.amazonaws.com, the Video Source is:

      rtmp://ec2-184-72-148-15.compute-1.amazonaws.com/live/livestream

    2. Click Preview to update the Embed Code.

    3. Click the Play button to play the video from your Flash Media Server on Amazon Web Services instance.

    You can select other options in the Flash Media Playback Setup page. After you change an option, click Preview to update the embed code.

    To embed Flash Media Playback in your own web page, copy the Preview Embed Code, and paste it into your HTML page.

Live streaming with Strobe Media Playback

  1. Complete the steps 1-3 in the Live streaming with Flash Media Playback tutorial.

  2. Download Strobe Media Playback from osmf.org and unzip it.

  3. Open the file strobe_root_folder/10.1/StrobeMediaPlayback.html in a text or HTML editor.

  4. Locate the following URL:

    "http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv"

    Replace the URL with the URL of the file you copied to the instance and save the file. Use the following syntax:

    "rtmp://public-dns/live/streamname"
  5. Open the StrobeMediaPlayback.html file in a browser and click Play.

    The file streams from the Flash Media Server on Amazon Web Services to the local version of Strobe Media Playback.

  6. You can also serve Strobe Media Playback and its supporting files from the Apache web server installed with Flash Media Server on Amazon Web Services. Copy the Strobe Media Playback files to the following directory:

    /mnt/webroot

    For example, create a folder /mnt/webroot/strobe. Copy the following files from the strobe_root_folder/10.1 folder to the /mnt/webroot/strobe folder:

    StrobeMediaPlayback.html, StrobeMediaPlayback.swf, the images folder, the scripts folder, and the playlists folder.

    Load the following URL into a browser and click play:

    http://public-dns/strobe/StrobeMediaPlayback.html

Live streaming with DVR

To add DVR functionality to a live stream, do the following:

  1. Download the DVRCast application from www.adobe.com/go/fms_tools and unzip it.

    Note: The DVRCast application was developed for Flash Media Server 3.5, but it supports Flash Media Server on Amazon Web Services as well.
  2. Copy the DVRCast application to the following location on the instance:

    /mnt/applications/dvrcast_origin

    Use the instructions at Connect to an instance and copy files from a Windows computer or Connect to an instance and copy files from a Linux/UNIX computer.

  3. Open Flash Media Live Encoder and enter the following:

    • For FMS URL, enter:

      rtmp://public-dns/dvrcast_origin

      Use the Public DNS value of the instance from the AWS Management Console.

    • For Stream, enter:

      livestream

    • Click Start to publish a stream to the dvrcast_origin application on the instance.

  4. Go to the Flash Media Playback Setup page at http://www.osmf.org/configurator/fmp/ and do the following:

    1. For Video Source, enter:

      rtmp://public-dns/dvrcast_origin/livestream

      For example, if the Public DNS of the instance is ec2-184-72-148-15.compute-1.amazonaws.com, the Video Source is:

      rtmp://ec2-184-72-148-15.compute-1.amazonaws.com/dvrcast_origin/livestream

    2. Click the Advanced tab and select Stream Type: DVR.

    3. Click Preview to update the Embed Code.

    4. Click the Play button to play the video from your Flash Media Server on Amazon Web Services instance.

    You can select other options in the Flash Media Playback Setup page. After you change an option, click Preview to update the embed code.

    To embed Flash Media Playback in your own web page, copy the Preview Embed Code, and paste it into your HTML page.

  5. When you terminate the instance, the data is deleted. To keep the recorded stream, copy it to a storage volume (EBS or S3). The stream is recorded to /mnt/applications/dvrcast_origin/streams/_definst_/. For information about transferring files, see Managing content.

Live HTTP Dynamic Streaming

Note: This tutorial assumes that you’ve completed the on-demand streaming tutorial and know how to launch an instance and connect to an instance.

Flash Media Server on Amazon Web Services includes an application called livepkgr that packages published streams for delivery using HTTP Dynamic Streaming.

  1. Open Flash Media Live Encoder and enter the following:

    • In the Encoding Options panel, from the Preset pop-up menu, choose Multi Bitrate - 3 Streams (1500 Kbps) - H.264.

    • Click the wrench next to Format to open Advanced Encoder Settings. For Keyframe frequency, select 4 seconds.

      Note: The Preset changes to Custom when you select this setting.
    • For Bit Rate, choose 100, 200, and 350.

    • For FMS URL, enter:

      rtmp://public-dns/livepkgr

      Use the Public DNS value of the instance from the AWS Management Console.

    • For Stream, enter:

      livestream%i?adbe-live-event=liveevent

    • Deselect Save to File.

    • Click Start to publish a stream to the livepkgr application on the instance.

  2. Go to the Flash Media Playback Setup page at http://www.osmf.org/configurator/fmp/ and do the following:

    1. For Video Source, enter:

      http://public-dns/live/events/livepkgr/events/_definst_/liveevent.f4m

      For example, if the Public DNS of the instance is ec2-184-72-148-15.compute-1.amazonaws.com, the Video Source is:

      http://ec2-184-72-148-15.compute-1.amazonaws.com/live/events/livepkgr/events/_definst_/liveevent.f4m

    2. Are you using HTTP Streaming or Flash Access 2.0? Select Yes.

    3. Click Preview to update the Embed Code.

    4. Click the Play button to play the video from your Flash Media Server on Amazon Web Services instance.

    You can select other options in the Flash Media Playback Setup page. After you change an option, click Preview to update the embed code.

    To embed Flash Media Playback in your own web page, copy the Preview Embed Code, and paste it into your HTML page.

On-demand HTTP Dynamic Streaming

Note: This tutorial assumes that you’ve completed the on-demand streaming tutorial and know how to launch an instance and connect to an instance.

To package an on-demand file for HTTP Dynamic Streaming, use the File Packager tool.

  1. Do the following to copy an FLV or F4V/MPEG-4 file from your local computer to the /webroot/vod directory on the Flash Media Server instance:

    • Open an SSH client and issue the following command to copy a file to the instance:

      scp -i keypair.pem filename.xxx root@public-dns:/mnt/webroot/vod

      For example, the following command copies the file sample.f4v to an instance:

      scp -i fmsdocs.pem sample.f4v root@ec2-184-72-148-15.compute-1.amazonaws.com:/mnt/webroot/vod
      Note: Use the Key Pair file you downloaded when you created the instance.
  2. Connect to the instance:

    ssh -i keypair.pem root@public-dns

  3. Change directories to the File Packager directory:

    cd /opt/adobe/fms/tools/f4fpackager

  4. Run the following command:

    export LD_LIBRARY_PATH=.

    Note: If you aren’t in the f4fpackager directory, specify the full path to the f4fpackager.
  5. Run the following command to package the sample.f4v file and copy the output files to the vod application’s media directory:

    ./f4fpackager --input-file=/mnt/webroot/vod/sample.f4v --output-path=/mnt/webroot/vod

    For more information, see Package content on Linux.

  6. Go to the Flash Media Playback Setup page at http://www.osmf.org/configurator/fmp/ and do the following:

    1. For Video Source, enter:

      http://public-dns/vod/filename.f4m

      For example, if the video you packaged was sample.f4v, the Video Source is:

      http://ec2-184-72-148-15.compute-1.amazonaws.com/vod/sample.f4m

    2. Are you using HTTP Streaming or Flash Access 2.0? Select Yes.

    3. Click Preview to update the Embed Code.

    4. Click the Play button to play the video from your Flash Media Server on Amazon Web Services instance.

    Note: See the On-demand streaming tutorial for more information about Flash Media Playback and Strobe Media Playback.
  7. When you terminate the instance, the data is deleted. To keep the recorded stream, copy it to a storage volume (S3 or EBS). For information about transferring files, see Managing content.

Multicast streaming

Important: Flash Media Server on Amazon Web Services supports peer-assisted multicast streaming. It does not support IP multicast or fusion multicast.

Copy the multicast tools to the webroot folder

Flash Media Server includes a Multicast Configurator tool and a Multicast Player. To access these tools from a web browser, move them to the webroot directory on the instance.

  1. Connect to the instance. Follow the steps in Connect to an instance and copy files from a Windows computer or Connect to an instance and copy files from a Linux/UNIX computer.

  2. The following directory contains the multicast tools:

    /opt/adobe/fms/tools/multicast/

    Move the multicast directory to the following location:

    /mnt/webroot/

    View full size graphic
    Using WinSCP to move the /multicast directory to the /mnt/webroot directory

Configure a multicast event

To multicast a live stream, use the Multicast Configurator to configure the streaming event. The Multicast Configurator generates a Publisher Stream Name that you’ll use to publish a stream from Flash Media Live Encoder. The Multicast Configurator also generates an F4M (Flash Manifest) file that you’ll use to play the stream in the Multicast Player.

to generate a stream name and a manifest file for the Multicast Player

  1. Open the following URL in a web browser:

    http://public-dns/multicast/configurator/configurator.html

    For example:

    http://ec2-174-129-151-131.compute-1.amazonaws.com/multicast/configurator/configurator.html

    View full size graphic
    Multicast Configurator
  2. Select Peer to Peer multicast.

    Flash Media Server on Amazon Web Services does not support Fusion or IP Multicast.

  3. Enter the server name (or IP address) and the full path to the multicast application:

    rtmfp://public-dns/multicast

  4. Enter the name of the live stream. This tutorial uses livestream.

  5. Enter a publish password.

    The password ensures that only the multicast server can publish a multicast stream into the group. Other peers do not have the publish password and can only play the stream, not publish a stream.

  6. Enter a name for the group. This tutorial uses the default name, fms.multicast.example.

    You can leave Make Unique unchecked.

  7. Click Generate. The Multicast Configurator generates the following:

    • A name for the live stream. To publish a stream, you’ll click Copy and paste this value into the Flash Media Live Encoder Stream field.

    • An F4M file to use with the client multicast player. To view the F4M file, click View Manifest File.

  8. Click Save Manifest File and do the following:

    1. Save the manifest.f4m file to your local computer.

    2. Connect to the instance. Follow the steps in Connect to an instance and copy files from a Windows computer or Connect to an instance and copy files from a Linux/UNIX computer.

    3. Copy the manifest.f4m file from your local computer to the following location:

      /mnt/webroot/multicast/multicastplayer/

      View full size graphic
      Using WinSCP to copy the manifest.f4m file to the instance

Publish a stream from Flash Media Live Encoder

  1. Launch Flash Media Live Encoder 3.1 or later and do the following:

  2. From the Preset menu, select a single stream preset. The multicast solution does not support multi-bitrate (also called “adaptive” and “dynamic”) streaming.

  3. For FMS URL, enter the URL of the multicast service:

    rtmp://public-dns/multicast

    Note: Flash Media Live Encoder connects to Flash Media Server over the RTMP protocol, not over the RTMFP protocol.
  4. Return to the Multicast Configurator and click Copy next to the Publisher Stream Name.

  5. In Flash Media Live Encoder, paste the Publisher Stream Name into the Stream text box.

  6. Click Start to connect to the multicast service and start streaming.

    View full size graphic
    Use Flash Media Live Encoder to capture and encode a live stream

Play a multicast stream

 Open the following URL in a web browser:

http://public-dns/multicast/multicastplayer/multicastplayer.html

The Adobe Flash Player Settings manager displays a Peer Assisted Networking dialog. Click Allow to allow the peer-to-peer connection.

Flash Player opens a Peer Assisted Networking dialog before the Multicast Player starts streaming

The Multicast Player plays the stream that Flash Media Live Encoder is publishing.

Multicast Player
Note: Multicast streaming requires Flash Player 10.1 and AIR 2.

For more information about the multicast service, see Using the multicast service in Flash Media Server Developer’s Guide. In the examples, remember that on Flash Media Server on Amazon Web Services, the installation directories are different than on other editions of the server. For information about installation directories, see Managing the server. Also, substitute the Public DNS of the Flash Media Server instance for localhost in the examples.