<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">Hi,<br>I'm not very familiar with gstreamer and I struggling to port a command line to python. Here the command line (linux):<br><br><span style="color:#2980b9;"><strong><span style="background-color:#ffffff;">$ gst-launch-1.0 -e rtspsrc location=rtsp://<user>:<password>@<ip>/<path>/media.amp latency=60 protocols=tcp ! rtph264depay ! h264parse ! splitmuxsink location=my_test.mov max-size-time=10000000000 max-size-bytes=40000000</span></strong></span><br><br>I wrote this python script:<br><br><strong><span style="color:#2980b9;">import time<br>import sys<br>import gi<br>gi.require_version('GLib', '2.0')<br>gi.require_version('Gst', '1.0')<br>from gi.repository import GLib, Gst<br><br>Gst.init(sys.argv)<br><br>print (Gst.MessageType)<br><br>def on_message(bus, message):<br> t = message.type<br> <br> print("[[", t , "]]")<br> <br> if t == Gst.MessageType.ERROR:<br> my_pipeline.set_state(Gst.State.NULL)<br> err, debug = message.parse_error()<br> print("(ERR): %s" % err, debug)<br> <br><br><br>my_pipeline = Gst.Pipeline.new("my-pipeline")<br>assert my_pipeline<br>print(my_pipeline)<br><br>my_rtspsrc = Gst.ElementFactory.make("rtspsrc", "rtspsrc")<br>assert my_rtspsrc<br>print(my_rtspsrc)</span><br><span style="color:#27ae60;">#my_rtspsrc.set_property("location", "rtsp://<ip>/<path>/media.amp")</span><br><span style="color:#2980b9;">my_rtspsrc.set_property("location", "rtsp://<user>:<password>@<ip>/<path>/media.amp")<br>my_rtspsrc.set_property("latency", 60)<br>my_rtspsrc.set_property("protocols", "tcp")</span><br><span style="color:#27ae60;">#my_rtspsrc.set_property("user-id", "<user>")</span><br><span style="color:#27ae60;">#my_rtspsrc.set_property("user-pw", "<password>")</span><br><br><span style="color:#2980b9;">my_rtph264depay = Gst.ElementFactory.make("rtph264depay", "rtph264depay")<br>assert my_rtph264depay<br>print(my_rtph264depay)<br><br>my_h264parse = Gst.ElementFactory.make("h264parse", "h264parse")<br>assert my_h264parse<br>print(my_h264parse)<br><br>my_splitmuxsink = Gst.ElementFactory.make("splitmuxsink", "splitmuxsink")<br>assert my_splitmuxsink<br>print(my_splitmuxsink)<br>my_splitmuxsink.set_property("max-size-time", 10000000000)<br>my_splitmuxsink.set_property("max-size-bytes", 40000000)<br>my_splitmuxsink.set_property("location", "my_test.mov")<br><br>bus = my_pipeline.get_bus()<br>bus.add_signal_watch()<br>bus.connect("message", on_message)<br><br>my_pipeline.add(my_rtspsrc)<br>my_pipeline.add(my_rtph264depay)<br>my_pipeline.add(my_h264parse)<br>my_pipeline.add(my_splitmuxsink)<br><br>my_rtspsrc.link(my_rtph264depay)<br>my_rtph264depay.link(my_h264parse)<br>my_h264parse.link(my_splitmuxsink)<br><br>my_pipeline.set_state(Gst.State.PLAYING)<br><br>try:<br> GLib.MainLoop().run()<br>except KeyboardInterrupt:<br> GLib.MainLoop().quit()</span></strong><br><br><br>(note: green lines are commented lines which represent something I tried.)<br><br>when I run the python script, I go this output:<br><span style="color:#2980b9;"><strong><span style="background-color:#ffffff;"><class 'gi.repository.Gst.MessageType'></span><br><span style="background-color:#ffffff;"><Gst.Pipeline object at 0x7f508072e870 (GstPipeline at 0x29e4080)></span><br><span style="background-color:#ffffff;"><__gi__.GstRTSPSrc object at 0x7f508070fee8 (GstRTSPSrc at 0x29ec820)></span><br><span style="background-color:#ffffff;"><__gi__.GstRtpH264Depay object at 0x7f508072ee58 (GstRtpH264Depay at 0x291c110)></span><br><span style="background-color:#ffffff;"><__gi__.GstH264Parse object at 0x7f508072eea0 (GstH264Parse at 0x2a0fa60)></span><br><span style="background-color:#ffffff;"><__gi__.GstSplitMuxSink object at 0x7f508072eee8 (GstSplitMuxSink at 0x2a18050)></span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STREAM_STATUS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STREAM_STATUS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_PROGRESS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_NEW_CLOCK of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_PROGRESS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_PROGRESS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_STATE_CHANGED of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_PROGRESS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_PROGRESS of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">[[ <flags GST_MESSAGE_ERROR of type Gst.MessageType> ]]</span><br><span style="background-color:#ffffff;">(ERR): gst-resource-error-quark: Could not open resource for reading and writing. (7) gstrtspsrc.c(7465): gst_rtspsrc_</span><br><span style="background-color:#ffffff;">retrieve_sdp (): /GstPipeline:my-pipeline/GstRTSPSrc:rtspsrc:</span><br><span style="background-color:#ffffff;">Failed to connect. (Generic error)</span></strong></span><br><br>well, I don't understand it. For me the command line and the script do the same thing. Anyone can help me?<br><br>regards,<br>Nicolas Jäger</div></body></html>