Hi,<br><br>I use gstreamer for playing RTSP stream from IP cameras like Axis. I use a command line like this:<br><br><span style="font-family: courier new,monospace;">gst-launch-0.10 rtspsrc location=rtsp://<a href="http://192.168.0.127/axis-media/media.amp">192.168.0.127/axis-media/media.amp</a> latency=0 ! decodebin ! autovideosink</span><br>
<br>and it work fine.<br><br>I want to control it with a gui in pygtk so I use the gstreamer python bindings. I've wrote this piece of code:<br><br><span style="font-family: courier new,monospace;">[...]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">self.player = gst.Pipeline("player")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">source = gst.element_factory_make("rtspsrc", "source")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">source.set_property("location", "rtsp://<a href="http://192.168.0.127/axis-media/media.amp">192.168.0.127/axis-media/media.amp</a>")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">decoder = gst.element_factory_make("decodebin", "decoder")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sink = gst.element_factory_make("autovideosink", "sink")</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">self.player.add(source, decoder, sink)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">gst.element_link_many(source, decoder, sink)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">bus = self.player.get_bus()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">bus.add_signal_watch()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">bus.enable_sync_message_emission()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">bus.connect("message", self.on_message)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">bus.connect("sync-message::element", self.on_sync_message)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[...]</span><br>
<br>But it doesn't work and quit with this message:<br><br><span style="font-family: courier new,monospace;">gst.element_link_many(source, decoder,sink)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">gst.LinkError: failed to link source with decoder</span><br>
<br><br>I've also try to improve my CLI with this as I only use h264:<br><br><span style="font-family: courier new,monospace;">gst-launch-0.10 -v rtspsrc location=rtsp://<a href="http://192.168.0.127/axis-media/media.amp">192.168.0.127/axis-media/media.amp</a> ! rtph264depay ! ffdec_h264 ! xvimagesink</span><br>
<br>And implement it in my python code like that:<br><br>[<span style="font-family: courier new,monospace;">...]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">self.player = gst.Pipeline("player")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">source = gst.element_factory_make("rtspsrc", "source")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">depay = gst.element_factory_make("rtph264depay", "depay")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">decoder = gst.element_factory_make("ffdec_h264", "decoder")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sink = gst.element_factory_make("xvimagesink", "output")</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">self.player.add(source, depay, decoder, sink)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">gst.element_link_many(source, depay, decoder, sink)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[...]</span><br><br>But I got the same error :(<br><span style="font-family: courier new,monospace;">gst.LinkError: failed to link source with depay</span><br>There is something wrong between my source (rtspsrc), as it work with decodebin with a filesrc (don't work of course with rtph264depay)<br>
<br>I don't understand why it doesn't work because it work in cli. Any experts of gstreamer who can help me ?<br><br>Thanks in advance.<br><br>Regards,<br>