Problems capturing to PNG images

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems capturing to PNG images

John Coppens
Hello all.

It seems I took on a too difficult task as my first Gst project. I want to monitor
a webcam, and, on clicking an image, save the picture. I'm using Gtk3 + introspection,
and GStreamer 1.0.

I got a chain working from v4l2src - filter - scale - convert - gtksink and was able
to embed the code into a Gtk GUI, though now it seems to have stopped updating.

I tried to 'tee' the signal from the viewer to a pngenc and then to a filesink,
but never got that working - the chain creates the image file, but leaves it empty.
I tried dozens of different approaches, even eliminating the viewer chain. In one
case I could get a gst-launch chain capturing the images correct to a png, but
translating the command into script did not work.

Also, I detected the camerabin[2] module, but didn't find any Python script that
uses it. I suspect that would solve my problem though.

I don't know the list's policy on attachments - if they're accept I could add
a compressed minimized program.

John
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems capturing to PNG images

James Cameron
How I've done it;

- last element in pipeline is gdkpixbufsink

- get the pipeline bus, with get_bus(),

- connect a handler for the 'message' signal,

- in the handler, use get_structure().get_name() to check for
  'pixbuf', and if so call get_proprty('last-pixbuf) on the
  gdkpixbufsink element,

- in the main program, call pixbuf.savev to convert to PNG file.

Hope that helps.

On Sun, Sep 09, 2018 at 03:30:40AM -0300, John Coppens wrote:

> Hello all.
>
> It seems I took on a too difficult task as my first Gst project. I want to monitor
> a webcam, and, on clicking an image, save the picture. I'm using Gtk3 + introspection,
> and GStreamer 1.0.
>
> I got a chain working from v4l2src - filter - scale - convert - gtksink and was able
> to embed the code into a Gtk GUI, though now it seems to have stopped updating.
>
> I tried to 'tee' the signal from the viewer to a pngenc and then to a filesink,
> but never got that working - the chain creates the image file, but leaves it empty.
> I tried dozens of different approaches, even eliminating the viewer chain. In one
> case I could get a gst-launch chain capturing the images correct to a png, but
> translating the command into script did not work.
>
> Also, I detected the camerabin[2] module, but didn't find any Python script that
> uses it. I suspect that would solve my problem though.
>
> I don't know the list's policy on attachments - if they're accept I could add
> a compressed minimized program.
>
> John
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

--
James Cameron
http://quozl.netrek.org/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems capturing to PNG images

John Coppens
On Mon, 10 Sep 2018 17:23:48 +1000
James Cameron <[hidden email]> wrote:

> How I've done it;
>
> - last element in pipeline is gdkpixbufsink
>
> - get the pipeline bus, with get_bus(),
>
> - connect a handler for the 'message' signal,
>
> - in the handler, use get_structure().get_name() to check for
>   'pixbuf', and if so call get_proprty('last-pixbuf) on the
>   gdkpixbufsink element,
>
> - in the main program, call pixbuf.savev to convert to PNG file.
>
> Hope that helps.

Thanks James!

Somehow Google never pointed me to that particular sink - a bit strange, as
many of the words must have coincided. And never crossed it in - at least -
dozens of examples I looked over.

As soon as I can get my hands on the camera again I'll try that out.

Cheers!
John
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel