简体   繁体   English

带gstreamer的色度键网络摄像头视频

[英]Chroma key webcam video with gstreamer

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: 我正在尝试在Fedora 21上将Logitech C910 WebCam与一个绿屏应用程序放在一起。我已经设法使用以下命令从网络摄像头中获取1080p30 h264视频,以便与gstreamer一起显示:

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. 从我阅读的内容中,我需要使用alpha过滤器来实现这一目标。 From looking at gst-inspect I can see that it takes in video/x-raw and outputs video/x-raw. 通过查看gst-inspect,我可以看到它接受了video / x-raw并输出了video / x-raw。 The avdec_h264 element outputs video/x-raw so it looks like I should be able to do: avdec_h264元素输出video / x-raw,因此看起来我应该能够做到:

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, 预先感谢您的帮助,

Mrs Kensington 肯辛顿夫人

You should connect alpha with xvimagesink via videoconvert element: 您应该通过videoconvert元素将alphaxvimagesink连接:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM