Jump to content
  • 0

SRT using Gstreamer


matmccann
 Share

Question

I am using gstreamer and I want to send SRT to media (enterprise version).  The tutorial uses OBS or FFmpeg; however, we are doing real-time streamming analytics and cannot introduce such a tool as the AI pipeline introduces a lot of lag between ingestion from cameras to sending to antmedia server (we program things ourself).

 

1. Is there any examples on how to send SRT using gstreamer to AntMedia server using `gst-launch-1.0`?

2. What types of connections do you support (caller, sender, rendezvous) and does ant media server act as the UDP server?

 

I have struggled for quick a while now and searched through all your documentation but it seems that most of the suggestions for ingestion involve using programs like FFMPEG or OSB.
For me, I am programmatically creating gstreamer pipelines and need to configure many of the underlaying properties.
- here is a simple pipeline I use to test sending SRT to the antmedia server (dockerized, and in 

# exports in linux terminal
export LOCAL_IP=172.23.0.11
export LOCAL_PORT=20001
export HOST_IP=172.23.0.4
export HOST_PORT=4200
export STREAM=stream
# attempt to launch a simplified pipeline using gstreamer's gst-launch to test connectivity (before programmatically creating it)
GST_DEBUG=3 gst-launch-1.0 -v filesrc location=$VID ! qtdemux ! queue ! h264parse ! avdec_h264 ! videoconvert ! x264enc tune=zerolatency ! "video/x-h264, profile=high" ! mpegtsmux alignment=7 ! srtsink uri="srt://$HOST_IP:$HOST_PORT/$STREAM?streamid=WebRTCAppEE/stream1" latency=1000 localaddress=$LOCAL_IP localport=$LOCAL_PORT

 

- this fails with `cannot get pbkeylen` and `Connection does not exist`

 

rad_perc@c97612813b15:/inference$ GST_DEBUG=srt*:5 gst-launch-1.0 -v filesrc location=$VID ! qtdemux ! queue ! h264parse ! avdec_h264 ! videoconvert ! x264enc tune=zerolatency ! "video/x-h264, profile=high" ! mpegtsmux alignment=7 ! srtsink uri="srt://$HOST_IP:$HOST_PORT/$STREAM?streamid=WebRTCAppEE/stream1" latency=1000 localaddress=$LOCAL_IP localport=$LOCAL_PORT
0:00:00.050725205 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:186:gst_srt_object_new:<GstSRTSink@0x562f763c09f0> Starting up SRT
0:00:00.050808991 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:561:gst_srt_object_set_uri:<GstSRTSink@0x562f763c09f0> set uri to (host: 127.0.0.1, port: 7001) with 0 query strings
0:00:00.050830451 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:561:gst_srt_object_set_uri:<srtsink0> set uri to (host: 172.23.0.4, port: 4200) with 1 query strings
Setting pipeline to PAUSED ...
0:00:00.053295991 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:999:gst_srt_object_open_full:<srtsink0> Opening SRT socket with parameters: application/x-srt-params, poll-timeout=(int)-1, latency=(int)1000, mode=(GstSRTConnectionMode)GST_SRT_CONNECTION_MODE_CALLER, localaddress=(string)172.23.0.11, localport=(uint)20001;
0:00:00.053333036 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:869:gst_srt_object_connect:<srtsink0> Binding to 172.23.0.11 (port: 20001)
Pipeline is PREROLLING ...
00:06:56.040383/SRT:RcvQ:worker*E:SRT.c: HS VERSION=5 but no handshake extension found!
00:06:56.040424/SRT:RcvQ:worker*E:SRT.c: processAsyncConnectRequest: REJECT reported from HS processing, not processing further.
00:06:56.040428/SRT:RcvQ:worker*E:SRT.c: RendezvousQueue: processAsyncConnectRequest FAILED. Setting TTL as EXPIRED.
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high, codec_data=(buffer)0164001fffe100196764001facd9405005ba10000003001000000303c0f183196001000668ebe3cb22c0, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high, codec_data=(buffer)0164001fffe100196764001facd9405005ba10000003001000000303c0f183196001000668ebe3cb22c0, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high, codec_data=(buffer)0164001fffe100196764001facd9405005ba10000003001000000303c0f183196001000668ebe3cb22c0, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Redistribute latency...
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high, codec_data=(buffer)0164001fffe100196764001facd9405005ba10000003001000000303c0f183196001000668ebe3cb22c0, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high, codec_data=(buffer)0164001fffe100196764001facd9405005ba10000003001000000303c0f183196001000668ebe3cb22c0, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)30/1
Redistribute latency...
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)30/1
Redistribute latency...
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)3.1, profile=(string)high, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)3.1, profile=(string)high, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/MpegTsMux:mpegtsmux0.GstPad:sink_65: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)3.1, profile=(string)high, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)3.1, profile=(string)high, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
0:00:00.087775977 17058 0x562f762c4c00 DEBUG                srtsink gstsrtsink.c:248:gst_srt_sink_set_caps:<srtsink0> setcaps video/mpegts, systemstream=(boolean)true, packetsize=(int)188
0:00:00.087785618 17058 0x562f762c4c00 DEBUG                srtsink gstsrtsink.c:256:gst_srt_sink_set_caps:<srtsink0> 'streamheader' field not present
0:00:00.087789673 17058 0x562f762c4c00 DEBUG                srtsink gstsrtsink.c:285:gst_srt_sink_set_caps:<srtsink0> Collected streamheaders: 0 buffers
/GstPipeline:pipeline0/MpegTsMux:mpegtsmux0.GstPad:src: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188
/GstPipeline:pipeline0/GstSRTSink:srtsink0.GstPad:sink: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188
0:00:00.087881974 17058 0x562f762c4c00 DEBUG                srtsink gstsrtsink.c:248:gst_srt_sink_set_caps:<srtsink0> setcaps video/mpegts, systemstream=(boolean)true, packetsize=(int)188, streamheader=(buffer)< 47400030a600ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000b00d0001c100000001e020a2c32941, 474020308b00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0002b0280001c10000e041f00c050448444d5688040ffffcfc1be041f00a050848444d56ff1b443f5a3175c0 >
0:00:00.087891468 17058 0x562f762c4c00 DEBUG                srtsink gstsrtsink.c:264:gst_srt_sink_set_caps:<srtsink0> 'streamheader' field holds array
/GstPipeline:pipeline0/MpegTsMux:mpegtsmux0.GstPad:src: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188, streamheader=(buffer)< 47400030a600ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000b00d0001c100000001e020a2c32941, 474020308b00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0002b0280001c10000e041f00c050448444d5688040ffffcfc1be041f00a050848444d56ff1b443f5a3175c0 >
0:00:00.087908432 17058 0x562f762c4c00 DEBUG                srtsink gstsrtsink.c:285:gst_srt_sink_set_caps:<srtsink0> Collected streamheaders: 2 buffers
/GstPipeline:pipeline0/GstSRTSink:srtsink0.GstPad:sink: caps = video/mpegts, systemstream=(boolean)true, packetsize=(int)188, streamheader=(buffer)< 47400030a600ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000b00d0001c100000001e020a2c32941, 474020308b00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0002b0280001c10000e041f00c050448444d5688040ffffcfc1be041f00a050848444d56ff1b443f5a3175c0 >
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
0:00:00.088338476 17058 0x562f762c4c00 DEBUG              srtobject gstsrtobject.c:1223:gst_srt_object_send_headers:<srtsink0> Sending 2 stream headers
New clock: GstSystemClock
0:00:00.310989454 17058 0x562f762c4c00 WARN               srtobject gstsrtobject.c:1252:gst_srt_object_send_headers:<srtsink0> error: Connection does not exist
ERROR: from element /GstPipeline:pipeline0/GstSRTSink:srtsink0: Could not write to resource.
Additional debug info:
gstsrtobject.c(1252): gst_srt_object_send_headers (): /GstPipeline:pipeline0/GstSRTSink:srtsink0:
Connection does not exist
Execution ended after 0:00:00.223051365
Setting pipeline to NULL ...
0:00:00.311523261 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:1194:gst_srt_object_wakeup:<srtsink0> waking up SRT
0:00:00.311786383 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:1194:gst_srt_object_wakeup:<srtsink0> waking up SRT
0:00:00.319534877 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:1032:gst_srt_object_close:<srtsink0> Closing SRT socket (0x1dbbcc3a)
Freeing pipeline ...
0:00:00.319668441 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:224:gst_srt_object_destroy:<srtsink0> Destroying srtobject
0:00:00.322096578 17058 0x562f763be0d0 DEBUG              srtobject gstsrtobject.c:231:gst_srt_object_destroy:<srtsink0> Cleaning up SRT


As SRT ingestion and extremely low latency WebRTC are two features that are offered with Ant Media, it was an easy choice of technology; however, the SRT ingestion is difficult to work out.  Can I get some support on this? Has anyone else sent SRT to AntMedia with gstreamer before?

Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0

Thank you! I have found a way by doing udp -> srt-live-transmit, but it introduces latency.  Perhaps we could jump on a quick call sometime and chat about it?  I'm actively developing on this and willing to put time into finding a good solution that we can share with others 🙂

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...