srtsrc fails when trying to use in python

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

srtsrc fails when trying to use in python

Michael-2
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:

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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: srtsrc fails when trying to use in python

Michael-2
I just enabled debugging in the python binding and this is what was reported:

0:07:51.868202400   304      0x2af2b20 INFO              mpegtsbase mpegtsbase.c:956:mpegts_base_apply_pat:<tsparse1> PAT
0:07:51.870829900   304      0x2af2b20 INFO        GST_ELEMENT_PADS gstelement.c:915:gst_element_get_static_pad: found pad tsparse1:sink
0:07:51.871850800   304      0x2af2b20 INFO               GST_EVENT gstevent.c:820:gst_event_new_caps: creating caps event video/mpegts, systemstream=(boolean)true, packetsize=(int)188
0:07:51.872122500   304      0x2af2b20 INFO               GST_EVENT gstevent.c:900:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:07:51.872205400   304      0x2af2b20 INFO                 tsparse mpegtsparse.c:817:drain_pending_buffers:<tsparse1> Pushing buffers - startTS 99:99:99.999999999 duration 0:00:00.000000000 0 bytes
0:07:51.872595500   304      0x2af2b20 INFO        mpegtspacketizer mpegtspacketizer.c:772:mpegts_try_discover_packet_size: have packetsize detected: 188 bytes
0:07:51.872804400   304      0x2af2b20 INFO              mpegtsbase mpegtsbase.c:956:mpegts_base_apply_pat:<tsdemux2> PAT
0:07:51.876829300   304      0x2af2b20 INFO               GST_EVENT gstevent.c:820:gst_event_new_caps: creating caps event video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal
0:07:51.877591400   304      0x2af2b20 INFO               GST_EVENT gstevent.c:820:gst_event_new_caps: creating caps event audio/mpeg, mpegversion=(int)2, stream-format=(string)adts
0:07:51.878054300   304      0x2af2b20 INFO        GST_ELEMENT_PADS gstelement.c:668:gst_element_add_pad:<tsdemux2> adding pad 'video_0_0100'
0:07:51.878119200   304      0x2af2b20 INFO        GST_ELEMENT_PADS gstelement.c:668:gst_element_add_pad:<tsdemux2> adding pad 'audio_0_0101'
0:07:51.878305800   304      0x2af2b20 WARN        mpegtspacketizer mpegtspacketizer.c:2334:mpegts_packetizer_pts_to_ts: Not enough information to calculate proper timestamp
0:07:51.886460600   304      0x2af2b20 WARN        mpegtspacketizer mpegtspacketizer.c:2334:mpegts_packetizer_pts_to_ts: Not enough information to calculate proper timestamp
0:07:51.975992100   304      0x2af2b20 INFO               GST_EVENT gstevent.c:900:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:07:52.244071900   304      0x2af2b20 INFO                 basesrc gstbasesrc.c:2981:gst_base_src_loop:<srtsrc0> pausing after gst_pad_push() = not-linked
0:07:52.244159500   304      0x2af2b20 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<srtsrc0> error: Internal data stream error.
0:07:52.244192500   304      0x2af2b20 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<srtsrc0> error: streaming stopped, reason not-linked (-1)
0:07:52.244299700   304      0x2af2b20 INFO        GST_ERROR_SYSTEM gstelement.c:2140:gst_element_message_full_with_details:<srtsrc0> posting message: Internal data stream error.
0:07:52.244444500   304      0x2af2b20 INFO        GST_ERROR_SYSTEM gstelement.c:2167:gst_element_message_full_with_details:<srtsrc0> posted error message: Internal data stream error.
0:07:52.244511700   304      0x2af2b20 INFO                    task gsttask.c:312:gst_task_func:<srtsrc0:src> Task going to paused

after a few seconds an endless loop of the SRT Lib follows:

16:08:39.981647/SRT:RcvQ:worker*E:SRT.c: %1003936651:No room to store incoming packet: offset=6784 avail=0 ack.seq=263638280 pkt.seq=263645064 rcv-remain=8191
...






Am Di., 18. Feb. 2020 um 15:34 Uhr schrieb Michael <[hidden email]>:
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:

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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: srtsrc fails when trying to use in python

Nicolas Dufresne-5
In reply to this post by Michael-2


Le mar. 18 févr. 2020 10 h 45, Michael <[hidden email]> a écrit :
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:

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)

Not-linked is a precise error in GStreamer. Did you forgot to track pad-added signal on tsdemux ? Denuxer have sometimes pads, so they need runtime linking.


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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: srtsrc fails when trying to use in python

Michael-2
Nicolas,

you are of course right!
I was not aware of the "sometimes"-pad mechanism and had to do this in the demuxer and not on the Srtsrc side, Thank you!

https://github.com/gkralik/python-gst-tutorial/blob/3734fd35b04e458acddeb2c45fe701b72f7c0b27/basic-tutorial-3.py#L89

did the trick

Am Di., 18. Feb. 2020 um 23:47 Uhr schrieb Nicolas Dufresne <[hidden email]>:


Le mar. 18 févr. 2020 10 h 45, Michael <[hidden email]> a écrit :
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:

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)

Not-linked is a precise error in GStreamer. Did you forgot to track pad-added signal on tsdemux ? Denuxer have sometimes pads, so they need runtime linking.


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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel