Question about writing a simple playback application

Nirbheek Chauhan nirbheek.chauhan at
Thu Oct 14 05:03:29 UTC 2021

On Thu, Oct 14, 2021 at 2:00 AM Matan Safriel via gstreamer-devel
<gstreamer-devel at> wrote:
> I spent some time digging through the api docs but am not sure whether these items are supported in the library, the FAQ pointed me at this mailing list for asking. I am wondering whether it should be a very robust use case to use gstreamer for a simple video playback application of the following kind ―
> I would like to have a video play while it is being programmatically controlled by my own code. The reason for this being that I am developing air-gesture for video control. It is not mandatory for my use case (not in the foreseeable future) that each and every video encoding format on earth would work, I'd gladly do with just a few of the more popular ones or ones that can be converted into a format where the below can be accomplished.
> So, here's the list of features I would like to have in my player, more or less in order of importance, the point being that I'd like my code to robustly control these aspects in real-time as the video is playing (my gesture recognition logic would have to trigger them and know their execution status) ...
> Control audio loudness and mute / un-mute.
> Pause and un-pause the playback
> Jump back (and forward) arbitrary to arbitrary locations (times) in the video.
> Speed up and slow down the playback compared to the video's original pace (without stopping the playback).
> Stretch ― fast forward and go back from the current video position to arbitrary video points while having a fast play effect between the current and target video locations (times).

You can use playbin:
playbin is just a wrapper around other gstreamer elements + some logic
that is commonly employed for video players. Here's a tutorial:
The tutorial doesn't focus on the things you need, but should be
useful as a reference. You can also look at the examples:

You can also use GstPlay instead of playbin:
It's a library that is supposed to make writing of video players
simpler. However it is relatively new (replacement for GstPlayer) and
hasn't been documented very well. The best place to look at examples
is the tests:

To help with your research, I'll just give you some general gstreamer
terminology to search the documentation with:

Audio volume and mute are simple properties on the bin.
Jumping back and forth is called seeking (relative or absolute,
key-unit or frame-accurate, etc), see start / stop arguments to
Speed up / slow down is also classified as seeking (playback rate, not
the same as the "video rate" aka framerate), see the "rate" argument
to gst_element_seek()
Stretch is just jump + speed combined, which is why gst_element_seek()
can do both at once

There's a bunch of video players and video editors that use gstreamer
to do all this and more, like Totem
[], Pitivi
[], and (Rust).

I would strongly recommend starting with the tutorials to understand

> Really stretch ― zoom into a particular section of the video as it is playing

Due to responsiveness reasons, this is generally handled at the
toolkit level since you can react immediately to user input (f.ex.,
pinch-zoom, ctrl + scrolling, etc). The usual way to do this is to use
a toolkit-specific video sink element, like qmlglsink or gtkglsink,
and zoom at the toolkit widget level in your app. You can also render
to an arbitrary GL texture on any toolkit in your app.

However, if that is not an option in your case, you can use either
compositor (software mixing) or glvideomixer (hardware-accelerated
mixing). You can set height / width / xpos / ypos etc properties on
the sink pad(s) of the element to change the size of the video in the
frame; to zoom out, zoom in, stretch aspect ratio, etc.

> So I wonder whether these items are features of the gstreamer library api. And in case they are, would you be able to point me in the right direction? I am also open to obtaining contractor work for developing such an application (and helping integrate it with a separate gesture recognition module).

There are a number of consultancies that provide services around
GStreamer, in alphabetical order (off the top of my head): Asymptotic
[], Centricular
[], Collabora
[], Fluendo
[], Igalia
[]. I work at Centricular.


More information about the gstreamer-devel mailing list