<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hello,
<div><br></div><div>I am trying to play a rtsp stream in a Clutter window with the following python code but it doesn't work. I think that gstreamer-vaapi works with clutter-gst.</div><div><br></div><div>Is it supposed to work with gstreamer-vaapi? What should be the correct way to do it?</div>

<div><br></div><div>Thank you.</div><div><br></div><div><div>#!/usr/bin/python3</div><div># Test playing video in Clutter texture under GTK3</div><div><br></div><div># gst-launch-1.0 -v rtspsrc location="rtsp://<a href="http://192.168.1.22/axis-media/media.amp" target="_blank">192.168.1.22/axis-media/media.amp</a>" ! rtph264depay  ! vaapidecode ! vaapisink</div>

<div><br></div><div>import gi</div><div>gi.require_version('Gst', '1.0')</div><div>from gi.repository import GtkClutter</div><div>GtkClutter.init([])</div><div>from gi.repository import GObject, Gst, Gtk, GstVideo, Clutter, ClutterGst</div>

<div><br></div><div>ClutterGst.init([])</div><div>GObject.threads_init()</div><div>Gst.init(None)</div><div><br></div><div>window = Gtk.Window()</div><div>embed = GtkClutter.Embed.new()</div><div>embed.set_size_request(500, 500)</div>

<div>window.add(embed)</div><div><br></div><div>stage = embed.get_stage()</div><div>stage.set_color(Clutter.Color.new(0,0,0,0))</div><div>stage.set_size(500, 500)</div><div><br></div><div>width_constraint = Clutter.BindConstraint.new(stage, Clutter.BindCoordinate.WIDTH, 0)</div>

<div>height_constraint = Clutter.BindConstraint.new(stage, Clutter.BindCoordinate.HEIGHT, 0)</div><div><br></div><div>texture = GtkClutter.Texture.new()</div><div>texture.set_keep_aspect_ratio(True)</div><div>texture.add_constraint(width_constraint)</div>

<div>texture.add_constraint(height_constraint)</div><div><br></div><div>pipeline = Gst.Pipeline()</div><div><br></div><div>src = Gst.ElementFactory.make("rtspsrc", "source")</div><div>src.set_property("location",'rtsp://<a href="http://192.168.1.22/axis-media/media.amp" target="_blank">192.168.1.22/axis-media/media.amp</a>')</div>

<div>src.set_property("latency",100)</div><div>pipeline.add(src)</div><div><br></div><div>rtph264depay = Gst.ElementFactory.make("rtph264depay", None)</div><div>vaapidecode = Gst.ElementFactory.make("vaapidecode", None)</div>

<div><br></div><div>pipeline.add(rtph264depay)</div><div>pipeline.add(vaapidecode)</div><div><br></div><div>sink = ClutterGst.VideoSink.new(texture)</div><div>pipeline.add(sink)</div><div><br></div><div>src.link(rtph264depay)</div>

<div>rtph264depay.link(vaapidecode)</div><div>vaapidecode.link(sink)</div><div><br></div><div><br></div><div>stage.add_actor(texture)</div><div>stage.show_all()</div><div><br></div><div><span style="white-space:pre-wrap">       </span></div>

<div>pipeline.set_state(Gst.State.PLAYING)</div><div>window.show_all()</div><div>GObject.MainLoop().run()</div><div><br></div><div><br></div><div><br></div></div><div><br></div><div>With the following command it does work : gst-launch-1.0 -v rtspsrc location="rtsp://<a href="http://10.101.7.156/axis-media/media.amp" target="_blank">10.101.7.156/axis-media/media.amp</a>" ! rtph264depay  ! vaapidecode ! vaapisink</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div><br></div><div><br></div><div><br></div><div>Erwan</div><div><br></div></font></span></div>
</div><br></div>