HLS vod with alternate audio tracks and using AMLST

Hi, all.

I want to create HLS streams with alternate audio tracks. Following the documentation (link [1] below), I’m able to manually create a SMIL file and accomplish this first goal. The contents of the SMIL file are below:

<?xml version="1.0" encoding="UTF-8"?>
<smil>
  <head />
  <body>
  <switch>
    <video src="mp4:video_audio_160p.mp4?audioindex=0" system-language="spa" title="Espanhol" audio-bitrate="119000">
      <param name="audioOnly" value="TRUE" valuetype="data" />
      <param name="cupertinoTag" value="EXT-X-MEDIA" valuetype="data" />
      <param name="cupertinoTag.GROUP-ID" value="aac" valuetype="data" />
      <param name="cupertinoTag.DEFAULT" value="YES" valuetype="data" />
    </video>
    <video src="mp3:audio_commentary.mp3" system-language="eng" title="Commentary" audio-bitrate="119000">
      <param name="audioOnly" value="TRUE" valuetype="data" />
      <param name="cupertinoTag" value="EXT-X-MEDIA" valuetype="data" />
      <param name="cupertinoTag.GROUP-ID" value="aac" valuetype="data" />
      <param name="cupertinoTag.DEFAULT" value="FALSE" valuetype="data" />          </video>
     <video src="mp4:video_audio_160p.mp4" width="284" height="160" video-bitrate="150000" audio-bitrate="119000">
      <param name="videoCodecId" value="avc1.100.30" valuetype="data" />
      <param name="cupertinoTag.AUDIO" value="aac" valuetype="data" />
      <param name="audioCodecId" value="mp4a.40.2" valuetype="data" />
    </video>
    <video src="mp4:video_audio_252p.mp4" width="448" height="252" video-bitrate="306863" audio-bitrate="119000">
      <param name="videoCodecId" value="avc1.100.30" valuetype="data" />
      <param name="cupertinoTag.AUDIO" value="aac" valuetype="data" />
      <param name="audioCodecId" value="mp4a.40.2" valuetype="data" />
    </video>
  </switch>
</body>
</smil>

The resulting (correct) “playlist.m3u8” is:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="spa",NAME="Espanhol",DEFAULT=YES,URI="chunklist_w753249042_b119000_ao_slspa_t64RXNwYW5ob2w=.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="Commentary",DEFAULT=FALSE,URI="chunklist_w753249042_b119000_ao_sleng_t64Q29tbWVudGFyeQ==.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=269000,CODECS="avc1.100.30,mp4a.40.2",RESOLUTION=284x160,AUDIO="aac"
chunklist_w753249042_b269000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=425863,CODECS="avc1.100.30,mp4a.40.2",RESOLUTION=448x252,AUDIO="aac"
chunklist_w753249042_b425863.m3u8

My problem is I can’t seem to do the same thing using AMLST (Java API). The resulting (incorrect) “playlist.m3u8” is:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=119000,NAME="AMLST Espanhol"
chunklist_w1886094069_b119000_ao_slspa_t64QU1MU1QgRXNwYW5ob2w=.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=119000,NAME="AMLST Commentary"
chunklist_w1886094069_b119000_ao_sleng_t64QU1MU1QgQ29tbWVudGFyeQ==.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=269000,CODECS="avc1.100.30,mp4a.40.2",RESOLUTION=284x160
chunklist_w1886094069_b269000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=425863,CODECS="avc1.100.30,mp4a.40.2",RESOLUTION=448x252
chunklist_w1886094069_b425863.m3u8

The Java module code I’m using is:

private MediaList buildPlaylistWithMultipleAudioTracks() {
    MediaList mediaList = new MediaList();
    MediaListSegment segment = new MediaListSegment();

    MediaListRendition rendition1 = new MediaListRendition();
    rendition1.setType(8);  // audio?
    rendition1.setBitrateAudio(119000);
    rendition1.setTitle("AMLST Espanhol");
    rendition1.setLanguage("spa");
    rendition1.setWowzaAudioOnly(true);
    rendition1.setName("mp4:video_audio_160p.mp4?audioindex=0");
    rendition1.setMediaListSegment(segment);
    segment.addRendition(rendition1);

    MediaListRendition rendition2 = new MediaListRendition();
    rendition2.setType(8);  // audio?
    rendition2.setBitrateAudio(119000);
    rendition2.setTitle("AMLST Commentary");
    rendition2.setLanguage("eng");
    rendition2.setWowzaAudioOnly(true);
    rendition2.setName("mp3:audio_commentary.mp3");
    rendition2.setMediaListSegment(segment);
    segment.addRendition(rendition2);

    MediaListRendition rendition3 = new MediaListRendition();
    rendition3.setType(9);   // video?
    rendition3.setName("mp4:video_audio_160p.mp4");
    rendition3.setBitrateAudio(119000);
    rendition3.setBitrateVideo(150000);
    rendition3.setWidth(284);
    rendition3.setHeight(160);
    rendition3.setAudioCodecId("mp4a.40.2");
    rendition3.setVideoCodecId("avc1.100.30");
    rendition3.setMediaListSegment(segment);
    segment.addRendition(rendition3);

    MediaListRendition rendition4 = new MediaListRendition();
    rendition4.setType(9);   // video?
    rendition4.setName("mp4:video_audio_252p.mp4");
    rendition4.setBitrateAudio(119000);
    rendition4.setBitrateVideo(306863);
    rendition4.setWidth(448);
    rendition4.setHeight(252);
    rendition4.setAudioCodecId("mp4a.40.2");
    rendition4.setVideoCodecId("avc1.100.30");
    rendition4.setMediaListSegment(segment);
    segment.addRendition(rendition4);

    mediaList.addSegment(segment);
    return mediaList;
}<br>

What is the correct way of using AMLST to create streams with alternate audio tracks?

Thanks and best regards,

– Andre de Souza

[1] https://www.wowza.com/docs/how-to-use-alternative-audio-or-video-tracks-with-apple-hls-streams#vod

Hi,

This has been addressed through ticket #227913, but I am copying the response here for others as well.

Your generated playlist is listing the alternate audio tracks as separate tracks (to be played without video) because of the setWowzaAudioOnly(true); method. You will need to instead create WMSProperties objects for each rendition in order to add the cupertino tags.

Here’s a code snippet the had the same playlist output as your SMIL file:

			MediaListRendition rendition1 = new MediaListRendition();
			segment.addRendition(rendition1);
			
		    rendition1.setType(IVHost.CONTENTTYPE_AUDIO);
		    rendition1.setBitrateAudio(119000);
		    rendition1.setTitle("AMLST Espanhol");
		    rendition1.setLanguage("spa");
		    rendition1.setName("mp4:video_audio_160p.mp4?audioindex=0");
	        // Add cupertino properties
	        WMSProperties props1 = rendition1.getProperties(true);
	        props1.setProperty("cupertinoTag", "EXT-X-MEDIA");
	        props1.setProperty("cupertinoTag.GROUP-ID", "aac");
	        props1.setProperty("cupertinoTag.DEFAULT", "YES");

					
			MediaListRendition rendition2 = new MediaListRendition();
			segment.addRendition(rendition2);
			
		    rendition2.setType(IVHost.CONTENTTYPE_AUDIO);
		    rendition2.setBitrateAudio(119000);
		    rendition2.setTitle("AMLST Commentary");
		    rendition2.setLanguage("eng");
		    rendition2.setName("mp3:audio_commentary.mp3");
	        // Add cupertino properties
	        WMSProperties props2 = rendition2.getProperties(true);
	        props2.setProperty("cupertinoTag", "EXT-X-MEDIA");
	        props2.setProperty("cupertinoTag.GROUP-ID", "aac");
	        props2.setProperty("cupertinoTag.DEFAULT", "FALSE");
	        
			MediaListRendition rendition3 = new MediaListRendition();
			segment.addRendition(rendition3);
			
		    rendition3.setName("mp4:video_audio_160p.mp4");
		    rendition3.setBitrateAudio(119000);
		    rendition3.setBitrateVideo(150000);
		    rendition3.setWidth(284);
		    rendition3.setHeight(160);
		    rendition3.setAudioCodecId("mp4a.40.2");
		    rendition3.setVideoCodecId("avc1.100.30");
	        // Add cupertino properties
	        WMSProperties props3 = rendition3.getProperties(true);
	        props3.setProperty("cupertinoTag.AUDIO", "aac");

			MediaListRendition rendition4 = new MediaListRendition();
			segment.addRendition(rendition4);
			
		    rendition4.setName("mp4:video_audio_252p.mp4");
		    rendition4.setBitrateAudio(119000);
		    rendition4.setBitrateVideo(306863);
		    rendition4.setWidth(448);
		    rendition4.setHeight(252);
		    rendition4.setAudioCodecId("mp4a.40.2");
		    rendition4.setVideoCodecId("avc1.100.30");
	        // Add cupertino properties
	        WMSProperties props4 = rendition4.getProperties(true);
	        props4.setProperty("cupertinoTag.AUDIO", "aac");

I received a playlist with the following:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="spa",NAME="AMLST Espanhol",DEFAULT=YES,URI="chunklist_w142149335_b119000_ao_slspa_t64QU1MU1QgRXNwYW5ob2w=.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="AMLST Commentary",DEFAULT=FALSE,URI="chunklist_w142149335_b119000_ao_sleng_t64QU1MU1QgQ29tbWVudGFyeQ==.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=269000,CODECS="avc1.100.30,mp4a.40.2",AUDIO="aac"
chunklist_w142149335_b269000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=425863,CODECS="avc1.100.30,mp4a.40.2",AUDIO="aac"
chunklist_w142149335_b425863.m3u8

Michelle

Hi,

This has been addressed in ticket #227913, but I am posting the response here as well for others.

Your generated playlist is listing the alternate audio tracks as separate tracks (to be played without video) because of the setWowzaAudioOnly(true); method. You will need to instead create WMSProperties objects for each rendition in order to add the cupertino tags.

Here’s a code snippet the had the same playlist output as your SMIL file:

			MediaListRendition rendition1 = new MediaListRendition();
			segment.addRendition(rendition1);
			
		    rendition1.setType(IVHost.CONTENTTYPE_AUDIO);
		    rendition1.setBitrateAudio(119000);
		    rendition1.setTitle("AMLST Espanhol");
		    rendition1.setLanguage("spa");
		    rendition1.setName("mp4:video_audio_160p.mp4?audioindex=0");
	        // Add cupertino properties
	        WMSProperties props1 = rendition1.getProperties(true);
	        props1.setProperty("cupertinoTag", "EXT-X-MEDIA");
	        props1.setProperty("cupertinoTag.GROUP-ID", "aac");
	        props1.setProperty("cupertinoTag.DEFAULT", "YES");

					
			MediaListRendition rendition2 = new MediaListRendition();
			segment.addRendition(rendition2);
			
		    rendition2.setType(IVHost.CONTENTTYPE_AUDIO);
		    rendition2.setBitrateAudio(119000);
		    rendition2.setTitle("AMLST Commentary");
		    rendition2.setLanguage("eng");
		    rendition2.setName("mp3:audio_commentary.mp3");
	        // Add cupertino properties
	        WMSProperties props2 = rendition2.getProperties(true);
	        props2.setProperty("cupertinoTag", "EXT-X-MEDIA");
	        props2.setProperty("cupertinoTag.GROUP-ID", "aac");
	        props2.setProperty("cupertinoTag.DEFAULT", "FALSE");
	        
			MediaListRendition rendition3 = new MediaListRendition();
			segment.addRendition(rendition3);
			
		    rendition3.setName("mp4:video_audio_160p.mp4");
		    rendition3.setBitrateAudio(119000);
		    rendition3.setBitrateVideo(150000);
		    rendition3.setWidth(284);
		    rendition3.setHeight(160);
		    rendition3.setAudioCodecId("mp4a.40.2");
		    rendition3.setVideoCodecId("avc1.100.30");
	        // Add cupertino properties
	        WMSProperties props3 = rendition3.getProperties(true);
	        props3.setProperty("cupertinoTag.AUDIO", "aac");

			MediaListRendition rendition4 = new MediaListRendition();
			segment.addRendition(rendition4);
			
		    rendition4.setName("mp4:video_audio_252p.mp4");
		    rendition4.setBitrateAudio(119000);
		    rendition4.setBitrateVideo(306863);
		    rendition4.setWidth(448);
		    rendition4.setHeight(252);
		    rendition4.setAudioCodecId("mp4a.40.2");
		    rendition4.setVideoCodecId("avc1.100.30");
	        // Add cupertino properties
	        WMSProperties props4 = rendition4.getProperties(true);
	        props4.setProperty("cupertinoTag.AUDIO", "aac");

I received the response as follows:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="spa",NAME="AMLST Espanhol",DEFAULT=YES,URI="chunklist_w142149335_b119000_ao_slspa_t64QU1MU1QgRXNwYW5ob2w=.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="AMLST Commentary",DEFAULT=FALSE,URI="chunklist_w142149335_b119000_ao_sleng_t64QU1MU1QgQ29tbWVudGFyeQ==.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=269000,CODECS="avc1.100.30,mp4a.40.2",AUDIO="aac"
chunklist_w142149335_b269000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=425863,CODECS="avc1.100.30,mp4a.40.2",AUDIO="aac"
chunklist_w142149335_b425863.m3u8

Michelle