Mix audio and video from different live sources with a Wowza Streaming Engine Java module

The ModuleAVMix module for Wowza Streaming Engine™ media server software allows you to create streams using audio and video tracks from separate sources.

Contents


Prerequisites
Installation
Configuration
Properties
Final configuration
Usage
For developers

Prerequisites


Wowza Streaming Engine 4.0.0 or later is required.

Installation


  1. Download wse-plugin-avmix.zip.
     
  2. Extract the contents from the downloaded (zipped) package, and then copy the lib/wse-plugin-avmix.jar file from the package to the lib folder in your Wowza Streaming Engine installation ([install-dir]/lib).
     
  3. Restart Wowza Streaming Engine.

Configuration


To enable this module, add the following module definition to your application configuration. See Configure modules for details.

Name
Description
Fully Qualified Class Name
ModuleAVMix Mixes audio and video sources. com.wowza.wms.plugin.avmix.ModuleAVMix

Properties


After enabling the module, you can adjust the default settings by adding the following properties to your application. See Configure properties for details.

Path
Name
Type
Value
Notes
/Root/Application avMixNames String outputName: stream1, videoName: myStream, audioName: audioStream | outputName: stream2, videoName: myOtherStream, audioName: audioStream2 Used to configure each stream. For more information on using this property, see Configuring avMixNames. (default: not set)
/Root/Application avMixSortDelay Integer 10000 Time (in milliseconds) to delay the output stream and smooth out data surges. -1 disables completely. Can be set at per-stream level or globally for all streams. (default: 10000)
/Root/Application avMixUseOriginalTimecodes Boolean false If both sources have synchronized timecodes, you can set this value to true to force the original timecodes to be used. Can be set at per-stream level or globally for all streams. Note: Unexpected results may occur if sources aren't synchronized. (default: false)
/Root/Application avMixDebugLog Boolean true Enables extra debug logging. (default: false)

Configuring avMixNames

The avMixNames property is a pipe-separated list of name: value pairs (name1: value1 | name2: value2) that define each stream configuration. The following name values can be used:
 
  • outputName – Required. The name of the output stream that will be used by players.
  • videoName – Recommended. The name of the source that contains a video track. If this value isn't set, then the output stream won't contain video.
  • audioName – Recommended. The name of the source that contains an audio track. If this value isn't set, then the output won't contain audio.
  • sortDelay – Optional. Overrides the avMixSortDelay property above with a new time (in milliseconds) to delay the output stream.
  • useOriginalTimecodes – Optional. Overrides the avMixUseOriginalTimecodes property.

Final configuration


You can use Java Management Extensions (JMX) or a separate module to adjust the stream configuration after it has been initially loaded. The following public methods are available from within the module:

Method
Description
addOrUpdateOutputStream(String outputName, String videoName, String audioName, long sortDelay, boolean useOriginalTimecodes) Adds a new configuration or updates an existing one.
setVideoSource(String outputName, String videoName) Updates the video source for a configuration referenced by outputName. If the configuration doesn't exist, it will be created.
setAudioSource(String outputName, String audioName) Updates the audio source for a configuration referenced by outputName. If the configuration doesn't exist, it will be created.
removeOutputStream(String outputName) Shuts down and removes a configuration referenced by outputName.
getOutputNames() Gets an array of currently configured output stream names.

Usage


When the application is started, the avMixNames property values are used to configure the output stream. Starting either the audio or video source triggers the output stream to start. The stream continues to run as long as one of the sources is running. The stream will stop automatically when both sources are stopped. If the sortDelay property is set, then the output startup, playback, and shutdown are delayed by this amount of time.

For developers