[gst-devel] gst buffer to image

Stefan Kost ensonic at hora-obscura.de
Thu Dec 10 22:57:06 CET 2009


Am 07.12.2009 02:48, schrieb Mailing List SVR:
> In data domenica 6 dicembre 2009 13:47:20, Gabriel Duarte ha scritto:
> : > How!
> 
> Basically you have to use a pipeline like this
> 
> gst.parse_launch('fakesrc name=src ! queue name=queue ! ffmpegcolorspace ! 
> video/x-raw-rgb,width=320,height=240 ! pngenc ! fakesink name=sink signal-
> handoffs=true')
> 
> and then push the frame with something like:
> 
> queue.get_pad('src').push(frame)
> 
> this way you'll get a png image,

irks, thats quite a hack. You should atleast use the handoff signal in fakesrc
or even better use appsrc. Both playbin and camerabin have such code (see
gstscreenshot.c in -base/gst/playback/)

Stefan

> 
> Nicola
> 
>>
>> On Sun, Dec 6, 2009 at 6:02 AM, Mailing List SVR 
> <lists at svrinformatica.it>wrote:
>>> I solved myself pushing the frame to a second pipeline,
>>>
>>> thanks
>>> Nicola
>>>
>>> In data sabato 5 dicembre 2009 23:27:59, Mailing List SVR ha scritto:
>>> : > In data sabato 5 dicembre 2009 19:39:31, Mailing List SVR ha scritto:
>>>> : > Hi all,
>>>>>
>>>>> I'm using a simple playbin pipeline, I can get the last frame with
>>>>>  something like this:
>>>>>
>>>>> In [124]: frame=player.get_property("frame")
>>>>>
>>>>> In [125]: frame
>>>>> Out[125]: <gst.Buffer 0x1fed6f0 of size 115200 and data 0x49484445>
>>>>
>>>> additionally:
>>>>
>>>> In [34]: frame.get_caps().to_string()
>>>> Out[34]: 'video/x-raw-yuv, width=(int)320, height=(int)240,
>>>> framerate=(fraction)10/1, format=(fourcc)I420,
>>>> interlaced=(boolean)false, pixel-aspect-ratio=(fraction)1/1'
>>>>
>>>> I tried this pipeline:
>>>>
>>>> gst-launch-0.10 -v filesrc location=/tmp/frame  ! "video/x-raw-yuv,
>>>> width=(int)320, height=(int)240, framerate=(fraction)10/1,
>>>> format=(fourcc)I420, interlaced=(boolean)false, pixel-aspect-
>>>> ratio=(fraction)1/1"  ! jpegenc ! filesink location=test.jpg
>>>>
>>>> but the jpg generated is bad (attacched). I attacch also the saved
>>>>  frame.data
>>>>
>>>>> now I can access frame.data that would be the raw frame data, but how
>>>
>>> to
>>>
>>>>> convert this frame to a jpg or png image? I tried to save the frame
>>>>> to
>>>
>>> a
>>>
>>>>>  file and to convert with jpegenc and pngenc with no success, any
>>>>>  suggestions?
>>>>>
>>>>> thanks
>>>>> Nicola
>>>
>>> -------------------------------------------------------------------------
>>>
>>>>> -- --- Join us December 9, 2009 for the Red Hat Virtual Experience, a
>>>
>>> free
>>>
>>>>> event focused on virtualization and cloud computing.
>>>>> Attend in-depth sessions from your desk. Your couch. Anywhere.
>>>>> http://p.sf.net/sfu/redhat-sfdev2dev
>>>>> _______________________________________________
>>>>> gstreamer-devel mailing list
>>>>> gstreamer-devel at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>
>>> -------------------------------------------------------------------------
>>> ----- Join us December 9, 2009 for the Red Hat Virtual Experience,
>>> a free event focused on virtualization and cloud computing.
>>> Attend in-depth sessions from your desk. Your couch. Anywhere.
>>> http://p.sf.net/sfu/redhat-sfdev2dev
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
> 
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing. 
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel





More information about the gstreamer-devel mailing list