繁体   English   中英

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

[英]Chroma key webcam video with gstreamer

我正在尝试在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

这很好,延迟低,效果很好。 我要做的下一件事是在我在网络摄像头图片后面添加图像/视频之前,对图片进行色度键控,使某些颜色透明。 从我阅读的内容中,我需要使用alpha过滤器来实现这一目标。 通过查看gst-inspect,我可以看到它接受了video / x-raw并输出了video / x-raw。 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

但是,每当我运行该命令时,我都会得到以下输出:

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 ...

谁能告诉我我所缺少的内容以及为什么它无法正常工作?

预先感谢您的帮助,

肯辛顿夫人

您应该通过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