Capturing image from pipeline

Nicolas Dufresne nicolas.dufresne at collabora.com
Mon Nov 18 06:13:08 PST 2013


Le dimanche 17 novembre 2013 à 09:19 -0800, yoyosuper8 a écrit :
> Sorry for the confusion. You are right, you can't do screenshot on android as
> I found out the hard way, so my next approach was to use gstreamer to
> capture an image for me.
> I just want to be able to push a button and have a still image of what is
> being viewed and store it as an image file png or jpeg.
> It looks like gst_video_convert_sample() is what I'm looking for, but I
> don't know how to use it. Can you provide and example please? 

Note that there is no single solution. It might be simpler to grab the
sample, and manually push it through a pipeline like this:

appsrc ! videoscale !videoconvert ! video/x-raw,width=...,height=... !
pngenc ! filesink location=...

And in the code:

g_object_get (sink, "last-sample", &sample, NULL);
gst_app_src_set_caps (appsrc, gst_sample_get_caps (sample));
gst_app_src_push_buffer (appsrc, gst_sample_get_buffer (sample));
gst_app_src_end_of_stream (appsrc);
gst_sample_unref (sample);

And some extra setting to make the appsrc async and listening to EOS
message to know when the file has been saves.

Please refer to reference manual for more details and extra settings.
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131118/69acb782/attachment.pgp>


More information about the gstreamer-devel mailing list