Chroma key webcam video with gstreamer
Michael Ditum
mike at mikeditum.co.uk
Fri May 8 06:13:39 PDT 2015
Hi Sergio,
That worked great! Can you explain why I needed that? Doing a gst-inspect
on the alpha element and the xvimagsink element, the xvimagesink component
doesn't seem to specify any color spaces it can handle. What would I have
needed to look at to know that I needed to add a videoconvert element
between the alpha and xvimagesink?
Also this seems to be using a lot of CPU which seems to all be down to the
alpha element. I assume this is normal?
Thanks for all your help,
Mike
On 6 May 2015 at 17:24, Sérgio Agostinho <sergio.r.agostinho at gmail.com>
wrote:
> Hi Mike,
>
> Try placing a videoconvert between the alpha and xvimagesink element.
>
> gst-launch-1.0 v4l2src device=/dev/video0 ! queue ! \
> video/x-h264,width=1920,height=1080,framerate=30/1 ! \
> h264parse ! avdec_h264 ! alpha method=green ! \
> *videoconvert* ! xvimagesink sync=false
>
>
> Cheers
>
> 2015-05-06 15:35 GMT+02:00 Michael Ditum <mike at mikeditum.co.uk>:
>
>> Hi,
>>
>> I'm trying to put together a green screen application with my Logitech
>> C910 WebCam on Fedora 21. I've managed to get 1080p30 h264 video from the
>> webcam to be displayed with gstreamer using the following command:
>>
>> gst-launch-1.0 v4l2src device=/dev/video0 ! queue ! \
>> video/x-h264,width=1920,height=1080,framerate=30/1 ! \
>> h264parse ! avdec_h264 ! xvimagesink sync=false
>>
>> This is working great with nice and low latency. The next thing I want to
>> do is Chroma Key-ing of the picture making certain colours transparent
>> before I add an image / video behind the webcam picture. From what I've
>> read I need to use the alpha filter to achieve this. From looking at
>> gst-inspect I can see that it takes in video/x-raw and outputs video/x-raw.
>> The avdec_h264 element outputs video/x-raw so it looks like I should be
>> able to do:
>>
>> gst-launch-1.0 v4l2src device=/dev/video0 ! queue ! \
>> video/x-h264,width=1920,height=1080,framerate=30/1 ! \
>> h264parse ! avdec_h264 ! alpha method=green ! \
>> xvimagesink sync=false
>>
>> However whenever I run that command I get the following output:
>>
>> Setting pipeline to PAUSED ...
>> Pipeline is live and does not need PREROLL ...
>> Setting pipeline to PLAYING ...
>> New clock: GstSystemClock
>> Redistribute latency...
>> ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal
>> data flow error.
>> Additional debug info:
>> gstbasesrc.c(2933): gst_base_src_loop ():
>> /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
>> streaming task paused, reason not-negotiated (-4)
>> Execution ended after 0:00:00.437613774
>> Setting pipeline to PAUSED ...
>> Setting pipeline to READY ...
>> Setting pipeline to NULL ...
>> Freeing pipeline ...
>>
>> Can anyone tell me what I'm missing and why this isn't working correctly?
>>
>> Thanks in advance for any help,
>>
>> Mike
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150508/fb4e431f/attachment.html>
More information about the gstreamer-devel
mailing list