[gst-devel] Playing RTSP with python-gstreamer

Sandino Flores Moreno tigrux at gmail.com
Wed Nov 17 18:44:45 CET 2010


Some pads are created on demand, that's why you cannot connect some
elements in advance.

An easier approach is to use gst.parse_launch(pipeline_desc_string)

###<<
pipeline = gst.parse_launch("rtspsrc name=source latency=0 ! decodebin
! autovideosink")
source = pipeline.get_by_name("source")
source.props.location =  "rtsp://192.168.0.127/axis-media/media.amp"
###>>

On Tue, Nov 16, 2010 at 5:28 AM, lonkaji <lonkaji at gmail.com> wrote:
> 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.amp
> latency=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,
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>




More information about the gstreamer-devel mailing list