Requirements

Prerequisite knowledge                                   Required products

Basic knowledge of using the Adobe Media Server                  Adobe Media Server 5 Standard
and know how to run a Flash based SWF client will                 Flash Player
help you make the most of this article.

 

Additional required other products

User level

Intermediate

 
With late-binding audio support in Adobe Media Server you can include alternative audio tracks with a single HTTP video stream.
 
A simplistic way to implement multiple audio track support within a client player is by creating two streams (either streams sourced from on-demand video (VOD) media files or live streams) with identical video content, but in different languages. You could then fetch both video streams in the player and offer the ability to toggle between both audio options. This implementation, however, requires unnecessary production and fetching of duplicate video content for the second stream.
 
A more efficient means for delivery of multiple audio tracks with Adobe Media Server is available by using the audio-only tag while fetching streams. Because only the audio content of secondary streams is sent, a significant amount of bandwidth can be saved by using this feature. 
 
This article describes a step-by-step process for configuring and using late-binding audio support in Adobe Media Server for HTTP streaming. To use this feature all related streams must be time synchronized. For VOD content, you'll need to ensure that media files are played individually. I recommend that you individually test each stream's URI. Similarly, for live streaming content, you should test individual streams if they are played separately.
 

HTTP Dynamic Streaming and on-demand video

 

 
For HTTP Dynamic Streaming (HDS) of on-demand video, the HDS-VOD module is configured (via HttpStreamingContentPath as per the Apache configuration) to get VOD media content from the ($AMS)/webroot/vod folder (assuming Adobe Media Server is installed in the $AMS folder).
 
Consider a situation in which you want to publish a video with English audio content named video1.mp4. In addition, you also want to offer the same content in French and Spanish, using alternative media files named video1_french.mp4 and video1_spanish.mp4 respectively. These secondary media files can have both audio and video content or just audio content.
 
The goal is enable viewers to switch the audio from the default language (in this case English) to the alternative languages (French and Spanish). To accomplish this, the first step is to create a set-level manifest file (for example, video1_master.f4m). This manifest file must include the video and audio track information as per the OSMF player specification. Although you can create this file manually, I find it easier to generate the manifest with the Configurator tool supplied with Adobe Media Server 5. This tool (f4mconfig.html) is located in the path ($AMS)\tools\f4mconfig\configurator . The following steps can be used to create the video1_master.f4m manifest file.
  1. Open the Configurator (f4mconfig.html) in a browser.
  2. For the Base URI, type the server address; for example, type  http://www.example.com/hds-vod/.
  3. Type video1.mp4.f4m as the Stream URI.
  4. Type the combined audio/video bitrate (for example, 500) as the Bitrate.
  5. Click Add.
  6. Confirm the media has been successfully added by reviewing its placement in the media list on the right (see Figure 1).

 

Figure 1. Adding the main video stream.
Figure 1. Adding the main video stream.
 
The next step is to add video1_french.mp4 as an alternate media file.
  1. Type audio-only/video1_french.mp4.f4m as the Stream URI. The audio-only prefix will signal the Adobe Media Server module to send only audio data for the video1_french.mp4 file.
  2. Type the bitrate for the audio content only as the Bitrate; for example, type 50.
  3. Select the Alternate: True option.
  4. Type fr as the Language.
  5. Type French as the Label, for ease of reference.
  6. Click Add.
  7. Verify the addition of the stream to the media list (see Figure 2).

 

Figure 2. Adding the French stream.
Figure 2. Adding the French stream.
 
Now you're ready to set up the Spanish stream using the same process.
  1. Type audio-only/video1_spanish.mp4.f4m as the Stream URI.
  2. Type 50 (the bitrate for the audio content only) as the Bitrate.
  3. Select the Alternate: True option.
  4. Type esp as the Language.
  5. Type Spanish as the Label.
  6. Click Add and verify the stream was added to the media list (see Figure 3).

 

Figure 3. Adding the Spanish stream.
Figure 3. Adding the Spanish stream.
 
  1.  Click Save Manifest and save the manifest as video1_master.f4m. Host this set-level manifest file and use its link for playback in your OSMF player. The generated manifest file will look something like:

 

<manifest xmlns="http://ns.adobe.com/f4m/2.0"> <baseURL>http://www.example.com/hds-vod/</baseURL> <media href="video1.mp4.f4m" bitrate="500"/> <media href="audio-only/video1_french.mp4.f4m" bitrate="50" type="audio" label="French" lang="fr" alternate="true"/> <media href="audio-only/video1_spanish.mp4.f4m" bitrate="50" type="audio" label="Spanish" lang="esp" alternate="true"/> </manifest>

 

HTTP Dynamic Streaming and live video

 

For HDS streaming of live video, the HDS-LIVE module is configured (via HttpStreamingContentPath and HttpStreamingLiveEventPath as per the Apache configuration) to get content from the ($AMS)/applications folder.
 
To understand how late-binding audio works with live streaming, consider a scenario in which stream1 is a video stream published via the Adobe Media Server livepkgr application. Additionally, the stream1_audio_french and stream1_audio_spanish audio streams are also published via livepkgr. All three streams are published over the same live event (stream1) by appending the query string parameter adbe-live-event=stream1 when publishing.
 
Similar to the HDS-VOD scenario, you need to define a set-level manifest file that meets the late-binding audio requirements of OSMF. As before, you can create the manifest file manually or use the Adobe Media Server Configurator tool. Follow these steps to use the tool to create a manifest file named stream1_master.f4m:
  1. Open f4mconfig.html in a browser.
  2. Type the server address as the Base URI;
  3. for example, type http://www.example.com/hds-live/livepkgr/_definst_/stream1.
  4. Type stream1.f4m as the Stream URI.
  5. Type the combined audio/video bitrate as the Bitrate; for example, type 500.
  6. Click Add.
  7. Confirm the stream has been added to the media list on the right (see Figure 4).

 

Figure 4. Adding a live stream.
Figure 4. Adding a live stream.

 

Next, you need to add stream1_audio_french as an alternate stream.
  1. Type stream1_audio_french.f4m as the Stream URI. Unlike the HDS-VOD example, you don't need to include the "audio-only" prefix because this stream has only audio content.
  2. Type the audio stream bitrate as the Bitrate; for example, type 50.
  3. Select the Alternate: True option.
  4. Type fr as the Language.
  5. Type French as the Label.
  6. Click Add and verify the stream has been added to the media list (see Figure 5).

 

Figure 5. Adding the French audio stream.
Figure 5. Adding the French audio stream.
 
Next add the Spanish audio stream.
  1. Type stream1_audio_spanish.f4m as the Stream URI. The "audio-only" prefix is not needed because this stream has only audio content.
  2. Type 50 (the audio stream bitrate) as the Bitrate.
  3. Select the Alternate: True option.
  4. Type esp as the Language.
  5. Type Spanish as the Label.
  6. Click Add and verify the stream has been added to the media list (see Figure 6).

 

Figure 6. Adding the Spanish audio stream.
Figure 6. Adding the Spanish audio stream.
 
  1. Click Save Manifest and save the manifest as stream1_master.f4m.
  2. Host this set-level manifest file and use its link for playback in your OSMF player.
The generated manifest file will look something like this:
 
<manifest xmlns="http://ns.adobe.com/f4m/2.0"> <baseURL>http://www.example.com/hds-live/livepkgr/_definst_/stream1/</baseURL> <media href="stream1.f4m" bitrate="500"/> <media href="stream1_audio_french.f4m" bitrate="50" type="audio" label="French" lang="fr" alternate="true"/> <media href="stream1_audio_spanish.f4m" bitrate="50" type="audio" label="Spanish" lang="esp" alternate="true"/> </manifest>

 

HTTP Live Streaming and on-demand video

 

For HTTP Live Streaming (HLS) of on-demand video, the HLS-VOD module is configured via the HttpStreamingContentPath parameter (as per the Apache configuration) to fetch VOD media content from the($AMS)/webroot/vod folder.
 
Consider the same scenario used in the HDS-VOD example using video1.mp4, video1_french.mp4, and video1_spanish.mp4 media files.
 
The first step is to create a variant playlist file, with information required by the M3U8 specification. The AMS Configurator tool can be used for creating such a playlist too.
  1. Open f4mconfig.html in a browser.
  2. Click the M3U8 tab.
  3. Type http://www.example.com/hls-vod/video1.mp4.m3u8 (the server address) as the Stream URI.
  4. Type 500 (the combined audio/video bitrate) as the Bitrate.
  5. Type video1 for the Audio Group-ID. This Group-ID will be used for grouping many media files for the main video1.mp4 stream.
  6. Specify the Codec and Resolution as per your requirements.
  7. Click Add and verify the stream has been added to the media list (see Figure 7).
Note: After adding a media file, you can optionally enable DRM. If it is enabled, a variant playlist file will be generated according to its activation.
 
Figure 7. Creating an M3U8 file.
Figure 7. Creating an M3U8 file.
 
  1.  Click Add Multiple Audio Options.
  2. In the media information tab, type video1 as the Group-ID. (This must be the same Group-ID as the video1.mp4 stream.)
  3. Because the original video1 is in English, type English as the Name.
  4. Select Default and AutoSelect.
  5. Type en as the Language.
  6. For the URL, type the full URL including the "audio-only" prefix, which  will inform the Adobe Media Server HLS-VOD module to extract and send only the audio of video1.mp4. For example, type http://www.example.com/hls-vod/audio-only/video1.mp4.m3u8.
  7. Click Add (see Figure 8).

 

Figure 8. Adding the English audio.
Figure 8. Adding the English audio.
 
  1.  Now, add the video1_french.mp4 media file using the same process and Group-ID. For the name, type French, and for the language type fr. Add the URL with the audio-only prefix. Do not select Default and AutoSelect (see Figure 9).

 

Figure 9. Adding the French audio stream.
Figure 9. Adding the French audio stream.
 
  1.  Using the same process and similar settings, add the video1_spanish.mp4.m4u8 media file (see Figure 10).

 

Figure 10. Adding the Spanish audio stream.
Figure 10. Adding the Spanish audio stream.
 
  1. Click Save Manifest and save the manifest file as video1_master.m3u8. Host this variant playlist file and use its link for playing in your HLS player. The generated variant playlist file looks something like this:

 

#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=500000,AUDIO="video1" http://www.example.com/hls-vod/video1.mp4.m3u8 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="video1", NAME="English", DEFAULT=YES, AUTOSELECT=YES, LANGUAGE="en", URI="http://www.example.com/hls-vod/audio-only/video1.mp4.m3u8" #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="video1", NAME="French", DEFAULT=NO, AUTOSELECT=NO, LANGUAGE="fr", URI="http://www.example.com/hls-vod/audio-only/video1_french.mp4.m3u8" #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="video1", NAME="Spanish", DEFAULT=NO, AUTOSELECT=NO, LANGUAGE="esp", URI="http://www.example.com/hls-vod/audio-only/video1_spanish.mp4.m3u8"

 

HTTP Live Streaming and live video

 

For HTTP Live Streaming (HLS) of live video, the HLS-LIVE module is configured via the HttpStreamingContentPath and HttpStreamingLiveEventPathparameters, as per the Apache configuration, to get content from the($AMS)/applications folder.
 
Under the same scenario as the HDS-LIVE example, you can make a variant M3U8 playlist file (in this case named stream1_master.m3u8) with the Configurator tool.
  1. Open f4mconfig.html in a browser.
  2. Click the M3U8 tab.
  3. Add the stream1 stream using parameters similar to the HLS-VOD example. Use the following Stream URI:
    http://www.example.com/hls-live/livepkgr/_definst_/stream1/stream1.m3u8
  4. Add stream1 as an alternate audio stream using the following media URL:
    http://www.example.com/hls-live/audio-only/livepkgr/_definst_/stream1/stream1.m3u8
  5. Add the French and Spanish media files as alternate audio for the same Group-ID using these URLs:
    http://www.example.com/hls-live/audio-only/livepkgr/_definst_/stream1/stream1_audio_french.mp4.m3u8 http://www.example.com/hls-live/audio-only/livepkgr/_definst_/stream1/stream1_audio _spanish.mp4.m3u8
The generated M3U8 file looks like the following:
 
#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=500000,AUDIO="stream1" http://www.example.com/hls-live/livepkgr/_definst_/stream1/stream1.m3u8 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stream1", NAME="English", DEFAULT=YES, AUTOSELECT=YES, LANGUAGE="en", URI=" http://www.example.com/hls-live/livepkgr/_definst_/stream1/stream1.m3u8" #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stream1", NAME="French", DEFAULT=NO, AUTOSELECT=NO, LANGUAGE="fr", URI=" http://www.example.com/hls-live/audio-only/livepkgr/_definst_/stream1/stream1_audio_french.mp4.m3u8" #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stream1", NAME="Spanish", DEFAULT=NO, AUTOSELECT=NO, LANGUAGE="esp", URI=" http://www.example.com/hls-live/audio-only/livepkgr/_definst_/stream1/stream1_audio_spanish.mp4.m3u8"

 

Where to go from here

 

For more details on configuring alternate audio in Adobe Media Server for HDS-VOD, see Configuring alternate audio in the Adobe Media Server Developer's Guide.
 
For HDS, an OSMF player can be used. OSMF detects the presence of alternate audio tracks from the F4M manifest. If an alternate audio track is selected, OSMF obtains the fragments for that track, and replaces the audio packets from the main video stream with the selected alternate. OSMF applies (multiplexes) the selected alternate track before passing the video stream to your player. To download a sample OSMF player, visit the SourceForge OSMF page.
 
If you are interested in building your own OSMF based player, see Supporting alternate audio tracks in HTTP Streaming videos in the Open Source Media Framework Developer's Guide.
 
For more information on IOS delivery, see the Apple Streaming Media Guide on HLS playback.
 
Lastly, for examples of M3U8 formatting for HLS, see the HTTP Live Streaming draft.