linux - 使用 gstreamer 的色度键网络摄像头视频

标签 linux video gstreamer fedora

我正在尝试在 Fedora 21 上将我的罗技 C910 网络摄像头与绿屏应用程序放在一起。我已经设法从网络摄像头获取 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,我可以看到它接收视频/x-raw 并输出视频/x-raw。 avdec_h264 元素输出视频/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

关于linux - 使用 gstreamer 的色度键网络摄像头视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30005021/

相关文章:

linux - 捕获键盘事件的shell脚本

c++ - 在 Visual Studio 2012 中使用 Gstreamer

android - YouTube 视频未在 WebView 中播放 - Android

ios将音视频url保存到文档目录

c - 如何在我的 gstreamer 中启用 httpsrc 插件?

python - 将 gst-launch 命令转换为 Python 程序

c++ - 在 while 循环中执行操作,直到调用组合键 C++

c - linux上实现链表的C程序从文件读取数据出错

linux - 如何在 x86 程序集中使用 "nanosleep"?

android - 视频纹理 : Augmented Reality Framework for Android