The GST-ANT Fusion plugin seamlessly integrates Ant Media Server with Gstreamer that is a well-know open-source multimedia framework.
The plugin is a game-changer for streamers and businesses providing the ability to customise 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.
sudo sh gst_plugin_install.sh
sudo service antmedia restart
There are two ways to register a stream for RTMP output.
REST API Method:
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/
ffplay rtsp://127.0.0.1:8554/stream1
Enabling RTSP by Default In the Configuration File:
/usr/local/antmedia/gst-plugin.cfg
# 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.
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
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/
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
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/
2. 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=srt://SRT_SERVER_ADDRESS:PORT?streamid=streamid "} http://localhost:5080/LiveApp/rest/pipeline/register-pipeline/
3. 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 Team. Create a new issue or search for related keywords to find an answer right away on our Github discussions.