issue to play a rtsp video with hardware acceleration in Clutter
Jezequel, Erwan
e.jezequel at fondation-parkings.ch
Fri Mar 28 04:13:22 PDT 2014
Hello,
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.
Is it supposed to work with gstreamer-vaapi? What should be the correct way
to do it?
Thank you.
#!/usr/bin/python3
# Test playing video in Clutter texture under GTK3
# gst-launch-1.0 -v rtspsrc location="rtsp://
192.168.1.22/axis-media/media.amp" ! rtph264depay ! vaapidecode ! vaapisink
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GtkClutter
GtkClutter.init([])
from gi.repository import GObject, Gst, Gtk, GstVideo, Clutter, ClutterGst
ClutterGst.init([])
GObject.threads_init()
Gst.init(None)
window = Gtk.Window()
embed = GtkClutter.Embed.new()
embed.set_size_request(500, 500)
window.add(embed)
stage = embed.get_stage()
stage.set_color(Clutter.Color.new(0,0,0,0))
stage.set_size(500, 500)
width_constraint = Clutter.BindConstraint.new(stage,
Clutter.BindCoordinate.WIDTH, 0)
height_constraint = Clutter.BindConstraint.new(stage,
Clutter.BindCoordinate.HEIGHT, 0)
texture = GtkClutter.Texture.new()
texture.set_keep_aspect_ratio(True)
texture.add_constraint(width_constraint)
texture.add_constraint(height_constraint)
pipeline = Gst.Pipeline()
src = Gst.ElementFactory.make("rtspsrc", "source")
src.set_property("location",'rtsp://192.168.1.22/axis-media/media.amp')
src.set_property("latency",100)
pipeline.add(src)
rtph264depay = Gst.ElementFactory.make("rtph264depay", None)
vaapidecode = Gst.ElementFactory.make("vaapidecode", None)
pipeline.add(rtph264depay)
pipeline.add(vaapidecode)
sink = ClutterGst.VideoSink.new(texture)
pipeline.add(sink)
src.link(rtph264depay)
rtph264depay.link(vaapidecode)
vaapidecode.link(sink)
stage.add_actor(texture)
stage.show_all()
pipeline.set_state(Gst.State.PLAYING)
window.show_all()
GObject.MainLoop().run()
With the following command it does work : gst-launch-1.0 -v rtspsrc
location="rtsp://10.101.7.156/axis-media/media.amp" ! rtph264depay !
vaapidecode ! vaapisink
Erwan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140328/180d4103/attachment-0001.html>
More information about the gstreamer-devel
mailing list