Chroma key webcam video with gstreamer

Michael Ditum mike at mikeditum.co.uk
Wed May 6 06:35:33 PDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150506/b4884602/attachment.html>


More information about the gstreamer-devel mailing list