[gst-devel] Playing RTSP with python-gstreamer

lonkaji lonkaji at gmail.com
Tue Nov 16 12:28:20 CET 2010


Hi,

I use gstreamer for playing RTSP stream from IP cameras like Axis. I use a
command line like this:

gst-launch-0.10 rtspsrc
location=rtsp://192.168.0.127/axis-media/media.amplatency=0 !
decodebin ! autovideosink

and it work fine.

I want to control it with a gui in pygtk so I use the gstreamer python
bindings. I've wrote this piece of code:

[...]
self.player = gst.Pipeline("player")
source = gst.element_factory_make("rtspsrc", "source")
source.set_property("location", "rtsp://192.168.0.127/axis-media/media.amp")
decoder = gst.element_factory_make("decodebin", "decoder")
sink = gst.element_factory_make("autovideosink", "sink")

self.player.add(source, decoder, sink)
gst.element_link_many(source, decoder, sink)

bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect("message", self.on_message)
bus.connect("sync-message::element", self.on_sync_message)
[...]

But it doesn't work and quit with this message:

gst.element_link_many(source, decoder,sink)
gst.LinkError: failed to link source with decoder


I've also try to improve my CLI with this as I only use h264:

gst-launch-0.10 -v rtspsrc location=rtsp://
192.168.0.127/axis-media/media.amp ! rtph264depay !  ffdec_h264 !
xvimagesink

And implement it in my python code like that:

[...]
self.player = gst.Pipeline("player")
source = gst.element_factory_make("rtspsrc", "source")
depay = gst.element_factory_make("rtph264depay", "depay")
decoder = gst.element_factory_make("ffdec_h264", "decoder")
sink = gst.element_factory_make("xvimagesink", "output")

self.player.add(source, depay, decoder, sink)
gst.element_link_many(source, depay, decoder, sink)
[...]

But I got the same error :(
gst.LinkError: failed to link source with depay
There is something wrong between my source (rtspsrc), as it work with
decodebin with a filesrc (don't work of course with rtph264depay)

I don't understand why it doesn't work because it work in cli. Any experts
of gstreamer who can help me ?

Thanks in advance.

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20101116/b1e97c48/attachment.htm>


More information about the gstreamer-devel mailing list