Create multitrack channel in Wowza Streaming Engine

We’re familiar with ABR stream playback, where we pick between multiple video bitrates. But what about streams with different audio tracks and different video pictures? Sometimes channel can be switched to different languages or different comments.

Wowza Streaming Engine allows to configure this kind of streams. The main gear is SMIL file where few sources can be aggregated and player settings can be set. This post describes how to set up audio multitracking step by step.

Set up channels-sources


The first step – ensure your parts of multitrack stream play back fine. Add to your Wowza origin server new channels: one per each audio track. You can start receiving streams permanently. Usually I configure it on Alias module configuration, you can do it with stream files.

If all audio tracks locate at the same stream source – then you need to find PID of each and point them on your stream configuration. Usually it comes from JSON configuration. Here is my example to split one source into multiple audio channels of channel 12.

ch12_fra={uri:"udp://239.10.10.11:1001", mpegtsAdjustBFrameTimecodes:true, mpegtsDropIncompleteVideoFrames:true, mpegtsAudioPID:4164}
ch12_eng={uri:"udp://239.10.10.11:1001", mpegtsAdjustBFrameTimecodes:true, mpegtsDropIncompleteVideoFrames:true, mpegtsAudioPID:4165}

Our goal here – set up mpegtsAudioPID parameter. The best way to find PIDs of stream – analyze it by FFmpeg.

  Program 4160 
    Metadata:
      service_name    : Channel5
      service_provider: Channel5
    Stream #0:15[0x1041]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:16[0x1044](fra): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s (clean effects)
    Stream #0:17[0x1045](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s

But don’t mess with number bases: FFmpeg prints out PIDs at the hex, while you need to set decimal. Just figure out to convert this value.

Configure channel SMIL file


Create new SMIL file at the storage directory of your Wowza application. By default it’s /usr/local/WowzaStreamingEngine/content. Name your file like the channel you want to play. Add there this SMIL markdown. Let’s name our channel as ch12.

<smil>
	<head>
	</head>
	<body>
		<switch>
			<video src="mp4:ch12_fra" system-language="sq" title="French" audio-bitrate="105768">
				<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"/>
				<param name="cupertinoTag.AUTOSELECT" value="YES" valuetype="data"/>
			</video>
			<video src="mp4:ch12_eng" system-language="en" title="English" audio-bitrate="105768">
				<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="NO" valuetype="data"/>
				<param name="cupertinoTag.AUTOSELECT" value="YES" valuetype="data"/>
			</video>
			<video src="mp4:ch12_fra" system-language="sq" title="Ch122" video-bitrate="2274910" width="768" height="432">
				<param name="videoCodecId" value="avc1.66.30" valuetype="data"/>
				<param name="videoOnly" value="TRUE" valuetype="data"/>
				<param name="cupertinoTag.AUDIO" value="aac" valuetype="data"/>
				<param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
			</video>
		</switch>
	</body>
</smil>

Here we collect 2 audio tracks with French and English respectively plus one video track. For this example ou can get the video source from ch12_eng too – doesn’t matter much. Settings like system language, audio bitrate, cupertino tags send to the player by Wowza. Processing this data, player creates a special window where you can switch between audio tracks.

Play your new channel


Try to play your SMIL file directly by this link.

http://[wowza_edge_ip]:[streaming_port]/[application_name]/SMIL:[channel_name].smil/playlist.m3u8

Example:

http://emample.com:1935/live/SMIL:ch12.smil/playlist.m3u8

Result:

Screenshot from 2016-05-29 08-01-17
That’s all necessary configuration of multitrack channel. Pay close attention: streams with multiple audio/video tracks are not supported everywhere. JWPlayer does it, what about VLC and television set-top boxes – not sure. Good luck with your international configuration 🙂

One thought on “Create multitrack channel in Wowza Streaming Engine

  1. Hello sir,
    I have new on wowza media server please explain me how to configure mpegtsAudioPID and where we find this command and where i configure in wowza.

    Like

Leave a comment