FrameStepping gstreamer1.x python and general

Luis de Bethencourt luis at debethencourt.com
Sat May 30 04:57:30 PDT 2015


On 30 May 2015 at 05:19, Turmel, Frederic <Frederic.Turmel at arris.com> wrote:

> More on this, I was reading the design for the step event. (
> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-framestep.txt
> )
>
> If I understand the step event correctly, a step event will skip the
> amount of frame specified in the event but those buffers/frames will be
> drop/flush. Then upon putting the pipeline to playing, it will start at the
> new position.
>
> If I'm correct, this may not be what I'm looking for.  What I'm trying to
> achieve is pause the pipeline and play frame by frame with a trigger, my
> app control when the next frame is sent to the sink.
>
> I did a simple test using filesink as the sink with uncompressed video.
> Nothing is written when I trigger the frame stepping event. I tried with
> and without the flush flag with same result.
>
> Any ideas/suggestions?
>
> Thanks
>
>
> -----Original Message-----
> From: gstreamer-devel [mailto:
> gstreamer-devel-bounces at lists.freedesktop.org] On Behalf Of Tim Müller
> Sent: Friday, May 29, 2015 2:21 AM
> To: Discussion of the development of and with GStreamer
> Subject: Re: FrameStepping gstreamer1.x python and general
>
> On Fri, 2015-05-29 at 10:58 +0200, Thibault Saunier wrote:
>
> > As for frame stepping support, I  do not think it is properly
> > implemented everywhere, best is to try it out and see/fix it/open a
> > bug if needed.
>
> Frame stepping is handled entirely by the sink base class and shouldn't
> require support from upstream elements (unless you want to step back, then
> it requires reverse playback support), so hopefully it to mostly just works
> whatever the source/demuxer/decoder (minus bugs of course, as Thibault
> said).
>
>  Cheers
>   -Tim
>
> --
> Tim Müller, Centricular Ltd - http://www.centricular.com
>

Here you have an example:
-------------------------------------------------------------------------------------------------
#!/usr/bin/env python

from gi.repository import Gst, GObject, GLib

Gst.init(None)

pipe = Gst.Pipeline.new('pipe')
src = Gst.ElementFactory.make('videotestsrc')
sink = Gst.ElementFactory.make("autovideosink")

pipe.add(src)
pipe.add(sink)
src.link(sink)

# pipe.set_state(Gst.State.PLAYING)
pipe.set_state(Gst.State.PAUSED)

def step():
    print 'step'
    sink.send_event(Gst.Event.new_step(Gst.Format.BUFFERS, 1, 1, True,
False))
    GLib.timeout_add(1000, step)

GLib.timeout_add(1000, step)

ml = GObject.MainLoop()
ml.run()
-------------------------------------------------------------------------------------------------

Run it and you can see that each frame will be displayed in the sink while
staying in PAUSED state.

Not sure if/how filesink handles step events. Use the above code to play
with frame stepping.

Thanks,
Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150530/be2f9ef7/attachment.html>


More information about the gstreamer-devel mailing list