srtsrc fails when trying to use in python

Michael Riha michael.riha at beyondthestatic.com
Tue Feb 18 14:32:34 UTC 2020


Hello everybody,

I am experimenting with GStreamer now for a few weeks
and after putting together some pipeline in the gst-launch-1.0 CLI
I started using python a few days ago.

Made good progress but I am stuck now with `srtsrc`.

I have a CLI-command inside a docker container which works as expected:

gst-launch-1.0 -v srtsrc uri="srt://:2088" \
! tsparse ! tsdemux ! h264parse ! avdec_h264 ! \
queue ! x264enc byte-stream=true ! h264parse config-interval=-1 ! \
queue ! matroskamux ! queue leaky=2 ! \
tcpserversink port=7001 host=0.0.0.0 recover-policy=keyframe

I feed this with FFMPEG outside of the container on port 2088 and play it
with `ffplay tcp://127.0.0.1:7001` without any problems!

But ... when I rebuild this CLI-command with python (creating elements and
linking them)

'srtsrc0'
srtsrc0->tsparse1
'tsparse1'
tsparse1->tsdemux2
'tsdemux2'
tsdemux2->h264parse3
'h264parse3'
h264parse3->avdec_h2644
'avdec_h2644'
avdec_h2644->queue5
'queue5'
queue5->x264enc6
'x264enc6'
x264enc6->h264parse7
'h264parse7'
h264parse7->queue8
'queue8'
queue8->matroskamux9
'matroskamux9'
matroskamux9->queue10
'queue10'
queue10->tcpserversink11

*Here the diagram:*

[image: srtPipeline.png]
Bus Messages (reduced):

Received message from -> tcpserversink11
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> queue10
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> matroskamux9
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> queue8
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> h264parse7
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> x264enc6
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> queue5
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> avdec_h2644
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> h264parse3
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> tsdemux2
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> tsparse1
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> srtsrc0
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> pipeline0
state changed: (oldstate=<enum GST_STATE_NULL of type Gst.State>,
newstate=<enum GST_STATE_READY of type Gst.State>, pending=<enum
GST_STATE_PLAYING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_CREATE of type
Gst.StreamStatusType>, owner=<__gi__.GstQueue object at 0x7f0e162bdcd0
(GstQueue at 0x2bae6f0)>)
Received message from -> queue10
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_ENTER of type
Gst.StreamStatusType>, owner=<__gi__.GstQueue object at 0x7f0e162bdcd0
(GstQueue at 0x2bae6f0)>)
Received message from -> matroskamux9
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_CREATE of type
Gst.StreamStatusType>, owner=<__gi__.GstQueue object at 0x7f0e162bd640
(GstQueue at 0x2bae3f0)>)
Received message from -> queue8
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_ENTER of type
Gst.StreamStatusType>, owner=<__gi__.GstQueue object at 0x7f0e162bd640
(GstQueue at 0x2bae3f0)>)
Received message from -> h264parse7
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> x264enc6
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_CREATE of type
Gst.StreamStatusType>, owner=<__gi__.GstQueue object at 0x7f0e162bd0a0
(GstQueue at 0x2bae0f0)>)
Received message from -> queue5
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_ENTER of type
Gst.StreamStatusType>, owner=<__gi__.GstQueue object at 0x7f0e162bd0a0
(GstQueue at 0x2bae0f0)>)
Received message from -> avdec_h2644
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> h264parse3
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> tsdemux2
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> tsparse1
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_CREATE of type
Gst.StreamStatusType>, owner=<__gi__.GstSRTSrc object at 0x7f0e162bb870
(GstSRTSrc at 0x2aca1b0)>)
Received message from -> srtsrc0
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> pipeline0
state changed: (oldstate=<enum GST_STATE_READY of type Gst.State>,
newstate=<enum GST_STATE_PAUSED of type Gst.State>, pending=<enum
GST_STATE_PLAYING of type Gst.State>)
Received message from -> src
stream status: (type=<enum GST_STREAM_STATUS_TYPE_ENTER of type
Gst.StreamStatusType>, owner=<__gi__.GstSRTSrc object at 0x7f0e162bb870
(GstSRTSrc at 0x2aca1b0)>)
Received message from -> pipeline0
Bus message: 18446744073709551615: <flags GST_MESSAGE_NEW_CLOCK of type
Gst.MessageType>
<Gst.Message object at 0x7f0e16488590 (GstMessage at 0x2b9db40)>
Received message from -> queue10
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> matroskamux9
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> queue8
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> h264parse7
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> x264enc6
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> queue5
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> avdec_h2644
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> h264parse3
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> tsdemux2
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> tsparse1
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)
Received message from -> srtsrc0
state changed: (oldstate=<enum GST_STATE_PAUSED of type Gst.State>,
newstate=<enum GST_STATE_PLAYING of type Gst.State>, pending=<enum
GST_STATE_VOID_PENDING of type Gst.State>)

As soon as I try to connect to `srtsrc` with FFMPEG
`ffmpeg  -re     -f lavfi     -i "testsrc=size=1920x1080:rate=25"     -f
lavfi     -i "sine=frequency=800:sample_rate=48000"     -preset:v superfast
    -pix_fmt yuv420p     -map 0:v     -map 1:a     -c:v libx264 -tune
zerolatency -profile:v high -preset veryfast  -g 30     -keyint_min 30 -b:v
2000k     -c:a aac -ar 48000 -ac 2 -max_muxing_queue_size 1024 -f mpegts
"srt://:2088"` (which works with the CLI-command above like a charm!!!)

the following is sent to the pipeline-bus:

Received message from -> tsparse1
Element message: sdt, section=(GstMpegtsSection)NULL;
Received message from -> tsparse1
Element message: pat, section=(GstMpegtsSection)NULL;
Received message from -> tsparse1
Element message: pmt, section=(GstMpegtsSection)NULL;
Received message from -> tsdemux2
Element message: pat, section=(GstMpegtsSection)NULL;
Received message from -> tsdemux2
Bus message: 18446744073709551615: <flags GST_MESSAGE_WARNING |
GST_MESSAGE_EXTENDED | GST_MESSAGE_STREAM_COLLECTION of type
Gst.MessageType>
<Gst.Message object at 0x7f0e16488590 (GstMessage at 0x7f0df0002b40)>
Received message from -> tsdemux2
Element message: pmt, section=(GstMpegtsSection)NULL;
Received message from -> srtsrc0
Error: gst-stream-error-quark: Internal data stream error. (1):
gstbasesrc.c(3072): gst_base_src_loop ():
/GstPipeline:pipeline0/GstSRTSrc:srtsrc0:
streaming stopped, reason not-linked (-1)

and the python-script is exited.

As I have already done some CLI-> python examples, I am quite sure that the
pipeline itself is rebuilt correct, but I am still new so I would
appreciate it very much if you could help me?


Thank you in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200218/37cb9ee8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: srtPipeline.png
Type: image/png
Size: 171569 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200218/37cb9ee8/attachment-0001.png>


More information about the gstreamer-devel mailing list