NO LONGER MAINTAINED
The GST-ANT Fusion plugin seamlessly integrates Ant Media Server with Gstreamer, which is a well-known open-source multimedia framework.
The plugin is a game-changer for streamers and businesses providing the ability to customize streaming pipelines to suit specific use cases and preferences. Whether it’s RTSP, RTP, RTMP, or even a combination of these protocols, the plugin empowers users to define and create their own Gstreamer pipelines that precisely align with their streaming requirements.
You need to have an active Ant Media Server license. You can subscribe through AWS Marketplace and deploy Ant Media Server with just one click. Or you can directly subscribe to a self-hosted license on our website. Check out our documentation to learn how to deploy Ant Media Server.
- Download Plugin dist.zip file according to your Ant Media Version
- Unzip dist.zip file and run the install script to install the plugin
sudo sh gst_plugin_install.sh
sudo service antmedia restart
The plugin comes with RTSP, RTMP, and RTP output capabilities by default. Also, you can register any Gstreamer pipeline you want by simply calling some REST endpoints.
There are two ways to register a stream for RTMP output:
- If you want to have RTSP output for any stream, you can simply send a REST API request to enable RTSP for that particular stream.
- If you want to have RTSP output for every stream without having to call a REST API, you can simply set RTSP by default in the plugin configuration file. In this way, you don’t need to call the REST API, and the RTSP stream will be available for every stream that you publish to Ant Media Server.
- You can send a video stream either with WebRTC, RTMP, RTSP, or SRT.
- Send a REST API request. RTSP supports both UDP and TCP, so you can set the protocol as TCP or UDP.
curl -X POST -H "Content-Type: application/json" -d '{"streamId":"stream1","pipeline_type":"RTSP_OUT","protocol":"TCP"}' http://localhost:5080/LiveApp/rest/pipeline/register-pipeline/
- Play the stream with ffplay.
- Change the IP Address in the command.
ffplay rtsp://127.0.0.1:8554/stream1
- Edit to
/usr/local/antmedia/gst-plugin.cfg
- Set RTSP in Default Protocols to 1 to set the desired protocol and port for RTSP output.
# set true or 1 for enabling by default
[DefaultProtocols]RTSP=1
RTMP=0
[RTSP]Port=8554
Protocol=TCP
[RTMP]appname=rtmpout
Port=1935
[RTP]
- Restart the server.
- Now for every stream that is published to the Ant Media server, The RTSP output stream will be available by default.
1.Create a new Appname on Ant Media with the name of rtmpout.
2. Set the following in application settings of rtmpout application :
settings.webRTCEnabled=false
settings.hlsMuxingEnabled=false
dashHttpStreaming=false
rtmpPlaybackEnabled=true
To enable RTMP output for a specific stream using the REST API, you can send a request as follows:
curl -X POST -H "Content-Type: application/json" -d '{"streamId":"stream1","pipeline_type":"rtmp_OUT","protocol":"TCP"}' http://localhost:5080/LiveApp/rest/pipeline/register-pipeline/
To play the stream using ffplay
, use the following command:
ffplay rtmp://localhost/rtmpout/streamid_rtmp_out
Make sure to change the IP address in the command accordingly.
- Edit the configuration file:
- Set RTMP in Default Protocols to 1 to enable RTMP by default:
- Restart the Ant Media server:
sudo nano /usr/local/antmedia/gst-plugin.cfg
[DefaultProtocols]
RTMP=1
RTSP=0
sudo systemctl restart antmedia
Now, RTMP output will be enabled by default for every stream published to the Ant Media server. Adjust the configuration settings as needed.
To play the stream using ffplay
, use the following command:
ffplay rtmp://localhost/rtmpout/streamid_rtmp_out
- You can send a video stream either with WebRTC, RTMP, RTSP, or SRT.
- Send a REST API request.
curl -X POST -H "Content-Type: application/json" -d '{"streamId":"stream1","pipeline_type":"RTP_OUT" , "port": "5000" , "host","127.0.0.1"}' http://localhost:5080/LiveApp/rest/pipeline/register-pipeline/
- Change the IP Address in the command.
gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
- You can send a video stream either with WebRTC, RTMP, RTSP, or SRT.
- Send a REST API request and pass your own custom Gstreamer pipeline with it.
Encoded video element will be available with the name element name as video and encoded audio element will be available with the name as audio. You can access the elements by name and to further complete the pipeline as desired. For example, you can get the video and audio and link it something like this:
mp4mux name=muxer video. ! muxer. ! audio. ! muxer. ! filesink location=./abc.mp4
If you don’t need to use any one of them you can simply link it to fakesink. For example, if you don’t need audio then you can connect audio. ! fakesink
- Recording with Gstreamer plugin using a custom Muxer (MKV, FLV, etc). The file will be saved in /usr/local/antmedia directory
curl -X POST -H "Content-Type: application/json" -d '{"streamId":"streamId_6FGwsZSNW","pipeline_type":"Gstreamer","protocol":"TCP", "pipeline":"matroskamux name=muxer video. ! muxer. ! audio. ! muxer. ! filesink location./abc.mp4 "}' http://localhost:5080/LiveApp/rest/pipeline/register-pipeline/
- Re-Stream to an SRT-Server
curl -X POST -H "Content-Type: application/json" -d '{"streamId":"streamId_6FGwsZSNW","pipeline_type":"Gstreamer","protocol":"TCP", "pipeline":"mpegtsmux name=muxer video. ! muxer. ! audio. ! muxer. ! srtsink uri=:PORT?streamid=streamid "}' http://localhost:5080/LiveApp/rest/pipeline/register-pipeline/
- Save only Audio of the stream as mp3 file.
curl -X POST -H "Content-Type: application/json" -d '{"streamId":"streamId_6FGwsZSNW","pipeline_type":"Gstreamer","protocol":"TCP", "pipeline":"lamemp3enc name=muxer video. ! fakesink. ! audio. ! muxer. ! filesink location=abc.mp3 "}' http://localhost:5080/LiveApp/rest/pipeline/register-pipeline
This plugin was developed by Ant Media Community. Create a new issue or search for related keywords to find an answer right away on our Github discussions.