the phrygian cap



Ohloh profile for Luis de Bethencourt

<Octubre 2015
Lu Ma Mi Ju Vi Sa Do
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
25 26 27 28 29 30 31

Creative Commons License

planet gnome
planet ubuntu
alberto ruiz
andy wingo
jeff fortin
slomo's blog
jan schmidt
vincent's random waffle

"all religions, arts and sciences are branches of the same tree. all these aspirations are directed toward ennobling man's life, lifting it from the sphere of mere physical existence and leading the individual towards freedom." albert einstein

awesome (gstreamer * clutter)

it is a known fact that gstreamer and clutter are both very cool. so what if we have gstreamer inside clutter, that is cool^2 which equals awesome.

let's go through a simple example the key of gstreamer inside clutter is the cluttergst python and its VideoSink function.

so you are going to create a gstreamer pipeline (just like we did in the previous blog post just shoot me), but use the cluttergst.VideoSink instead of gst element xvimagesink and feed that to a clutter.Texture():

import clutter, gst, cluttergst

video_texture = clutter.Texture()
pipeline = gst.Pipeline()
src = gst.element_factory_make("v4l2src", "src")
colorspace = gst.element_factory_make("ffmpegcolorspace", "colorspace")
sink = cluttergst.VideoSink(video_texture)
pipeline.add(src, colorspace, sink)
gst.element_link_many(src, colorspace, sink)

now you need a clutter stage with the videotexture in it:

stage = clutter.stage_get_default()

wait, this is clutter... let's animate the gstreamer texture! for this you need a clutter timeline, alpha (value as function of time) and behaviour:

timeline = clutter.Timeline(250,50)
alpha = clutter.Alpha(timeline, clutter.sine_half_func)
behaviour = clutter.BehaviourRotate(alpha=alpha, \
angle_start=30.0, angle_end=5.0, axis=clutter.Y_AXIS, \
direction = "ccw")

we are ready for the show:


wasn't that awesome \m/?

now check the example, it has videofile playback and more animation behaviours.

8 Comentarios

Referencias (TrackBacks)

URL de trackback de esta historia


De: Flimm Fecha: 2009-02-16 21:50

Why isn't python-clutter included in the Intrepid universe repos?
I tried installing python-clutter from Jaunty's repos, but all would give me was a black window. Is it meant to work with your webcam?

De: luisbg Fecha: 2009-02-16 22:42

will use the webcam
./ -i /path/to/videofile
will play a videofile

don't know about the intrepid repo issue.

De: Senko Fecha: 2009-02-17 00:36

There's also cluttergst.VideoTexture that encompasses Texture+Playbin+VideoSink functionality.

tx = cluttergst.VideoTexture()
bin = tx.get_playbin() # if you want to use the inner Playbin directly

De: luisbg Fecha: 2009-02-17 01:11

senko: wow! I didn't knew that. that is brilliant.

De: martin Fecha: 2009-07-07 14:52

Using kubuntu jaunty:

$ python
Fatal Python error: unable to initialise cluttergst module

De: deepsight Fecha: 2010-04-21 18:04

Have you tried having two videos at the same time? i try with one v4l2src and one videotestsrc; they show on the screen but they pause continuously at the same time. Any ideas?

De: curcumin Fecha: 2012-03-29 14:21

This one is your one of the nice blog dude I like it very much so I want to keep in touch with your blogs therefore post more blogs and thank you dear for sharing with us such nice information.

De: maquinas de bordar Fecha: 2012-03-30 07:54

I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here frequently. I am quite sure I will learn many new stuff right here! Best of luck for the next!

Dirección IP: (634f5fb769)

©2007-2013 luis de bethencourt guimera
powered by Blogalia