First steps to extracting some video with Gstreamer 1.2.1

Tim Müller tim at centricular.com
Mon Dec 2 03:06:28 PST 2013


On Mon, 2013-12-02 at 19:55 +0900, Lasse Laursen wrote:

Hi Lasse,

> I'm commencing my first steps to try and extract some individual video 
> frames from video to use in my application. I hope you won't mind if I 
> ask some fairly basic questions here regarding how to proceed and if 
> I've understood everything correctly.

No worries, that's what the list is for.

> To be brief my goal is - at first - to open most any video file  and 
> extract a few raw frames which I will manually put on to an OpenGL 
> texture for use. The audio that is attached to the video is kind of 
> irrelevant for me. At this time I would generally just ignore it. I 
> should note that I'm not really set on opening most video types - in 
> fact I'll probably settle for a very specific format that suits my 
> needs, but at first it'd be nice just to extract some frames from any 
> video type I happen to have lying around.
> 
> I've read through most of the gstreamer 0.1 tutorials just to get a 
> basic idea of how the framework works, but there are a few things I'm 
> still a bit hazy about and I thought I'd ask here just to get an 
> uptodate reply:
> 
> 1) Given that - at first - I'm keen to just open any video file and get 
> a the frames, it seems like I need to look closer at the uridecodebin 
> base plugin. I've also noticed the autovideosrc good plug in, and I'm 
> guessing that it's closely related to the first plugin I mentioned?

Why autovideosrc? You want to read videos from file, don't you? In which
case the source will always be a filesrc (which uridecodebin will create
if you use file:// URIs).

> 2) Since I'm keen to - at first - open most any video file, I'm guessing 
> I'll often end up with a pipeline that uses a demuxer which will provide 
> me with both an audio and video src. I need to pipe the audio output 
> into a trash sink as I'm not interested in ever using it. Is that just 
> the appsink plugin? It seems to double as both an all purpose sink and a 
> sink used for grabbing data for use in an application.

fakesink is more like a "trash sink", it's "/dev/null" basically. But
you could also just ignore audio pads and leave them unlinked. Appsink
is for when the application wants to pull data out of a pipeline.

You might find

http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/tests/examples/snapshot/snapshot.c

interesting. (You'll get an RGB frame, which of course you don't have to
feed it to GdkPixbuf, but can pass to OpenGL as well). If you want to do
smooth video playback rather than extract specificc frames, then there
may be better solutions. 

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com






More information about the gstreamer-devel mailing list