How to control MPEG-DASH fragment IDs and timecodes

You can use the API to adjust the chunk IDs and timecodes of live MPEG-DASH streams as they're packetized by Wowza Streaming Engine live streaming software. This can be useful for synchronizing streams between Wowza media servers for redundancy.

Note: Wowza Streaming Engine™ 4.5.0 or later is required.

To implement, create a class that implements the IHTTPStreamerMPEGDashLiveStreamPacketizerChunkIdHandler interface and add the mpegdashChunkIdHandlerClass property to the <LiveStreamPacketizer>/<Properties> section of [install-dir]/conf/[application-name][/Application.xml. A new instance of your class will be created each time an MPEG-DASH packetizer is created. The init method will be called for each new instance. The onAssignChunkId method will be called at the start of each new fragment. In the onAssignChunkId, return either a new HTTPStreamerMPEGDashLiveStreamPacketizerChunkIdContext object with your adjusted timecode and chunk ID info or null to use the information that was passed into the call.

The following is an example implementation that offsets a stream by 1000000000L milliseconds:

package com.wowza.wms.plugin.test2.mpegdashchunkid;

import com.wowza.wms.httpstreamer.mpegdashstreaming.livestreampacketizer.*;

public class MPEGDashLiveStreamPacketizerChunkIdHandlerTest implements IHTTPStreamerMPEGDashLiveStreamPacketizerChunkIdHandler
	LiveStreamPacketizerMPEGDash liveStreamPacketizer = null;

	public void init(LiveStreamPacketizerMPEGDash liveStreamPacketizer)
		this.liveStreamPacketizer = liveStreamPacketizer;

	public HTTPStreamerMPEGDashLiveStreamPacketizerChunkIdContext onAssignChunkId(HTTPStreamerMPEGDashLiveStreamPacketizerChunkIdContext chunkIdContext)
		long timecode = chunkIdContext.getTimecode();
		long chunkIndex = chunkIdContext.getChunkIndex();

		int chunkDurationTarget = liveStreamPacketizer.getChunkDurationTarget();

		long timecodeNew = timecode + 1000000000L;
		long chunkIndexNew = 1 + (timecodeNew/chunkDurationTarget);

		System.out.println("onAssignChunkId: tc:"+timecodeNew+"/"+timecode+" index:"+chunkIndexNew+"/"+chunkIndex);

		return new HTTPStreamerMPEGDashLiveStreamPacketizerChunkIdContext(chunkIndexNew, timecodeNew);

It's important that the chunk ID is calculated as specified above. It should be:

chunkIndexNew = 1 + (timecodeNew/chunkDurationTarget);

This is required for many MPEG-DASH players to work properly since they use the chunk ID and availability start time to determine the next chunk ID to request.

Set the <LiveStreamPacketizer>/<Properties> property in [install-dir]/conf/[application-name]/Application.xml for the above class as follows:


Originally Published: For Wowza Streaming Engine 4.5.0 on 06-23-2016.

If you're having problems or want to discuss this article, post in our forum.