The Filter Plugin provides users to perform real-time audio and video manipulation on the server side. With this plugin, you may add filters to ongoing streams using REST API.
The MCU, which allows users to combine video and audio into a single stream for a conference room, is the main application of the filter plugin. Also, this plugin contains MCU implementation, which helps you to merge or mix streams in a single stream in a conference call. You may find more details here in this blog post.
This plugin shipped with Ant Media Server Enterprise version v2.4.0.2 with a built-in filtering feature. So, you’ll need Ant Media Server Enterprise Edition to leverage cpblities of filter plugin.
Before Starting
You need to have an active Ant Media Server(AMS) license. You can subscribe through AWS and deploy AMS with just one click. Or directly subscribe to a self-hosted license on our website. Please contact us for details
Example API Call: You can apply a vertical flip filter to video and copy the filter to audio with the following REST method call:
curl -i -X POST -H "Accept: Application/json" -H "Content-Type: application/json" "http://localhost:5080/WebRTCAppEE/rest/v2/filters/create" -d '{"inputStreams":["stream1","stream2"],"outputStreams":["test"],"videoFilter":"[in0]copy[out0]","audioFilter":"[in1]acopy[out0]","videoEnabled":"true","audioEnabled":"true"}'
Here we tried merging stream1‘s video with stream2‘s audio into a new stream test.
To build Filter Plugin you will need first clone and build ant-media-server-parent project.
You can build it with the following maven command:
mvn clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Dgpg.skip=true
After building the parent project you can build filter project with the same maven command:
mvn clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Dgpg.skip=true
Once,followed above steps. You will get the new ant-media-filter-plugin.jar file in the target folder and copy it into /usr/local/antmedia/plugins directory.
MCU Usage
Step 1. Add an adaptive setting
You should add at least one adaptive setting from Ant Media Server Management Panel to use the MCU feature as in the following screenshot.
You should open the conference page provided with Ant Media Server installation. You can access it from this URL:
https://YOUR_DOMAIN:5443/WebRTCAppEE/conference.html
After opening the conference page don’t forget to enable MCU. Then enter the room name and click join.
Since we enabled the MCU in Step 2, a new broadcast (the Mixed Broadcast) is created by the server with the stream Id which is the same as the room name. This broadcast contains the all video and audio of the streams in the conference room. You can see it on the Live Stream List in Management Panel.
https://YOUR_DOMAIN:5443/WebRTCAppEE/play.html?id=YOUR_ROOM_NAME