linux - 下沉到虚拟 v4l2 设备
问题描述
我在 Ubuntu 19.04 上试过一个例子
gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video10
但是 gstreamer 失败了
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Cannot identify device '/dev/video10'.
Additional debug info:
v4l2_calls.c(609): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
system error: No such file or directory
Setting pipeline to NULL ...
Freeing pipeline ...
为什么它不起作用?我在文档中没有找到这个,我需要以某种方式创建 /dev/video10 吗?
我对默认设备 /dev/video1 做了同样的事情,但它是我笔记本电脑上的输入摄像头设备:
sudo gst-launch-1.0 videotestsrc ! v4l2sink
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video1' is not a output device.
Additional debug info:
v4l2_calls.c(639): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
Capabilities: 0x4a00000
Setting pipeline to NULL ...
Freeing pipeline ...
预先感谢。
解决方案
您的问题标题表明您想写入虚拟视频设备。v4l2 设备既可以是输入视频设备,也可以是输出视频设备。您的相机是视频输入(捕捉)设备。在 gstreamer 中引导 v4l2sink(因此是管道的端点)可能会失败。
但是,您可以生成虚拟输出设备。您正在寻找的是类似v4l2-loopback设备的东西。它允许您生成这样的虚拟/dev/video10
设备:
modprobe v4l2loopback video_nr=10
推荐阅读
- google-cloud-bigtable - 我们如何使 cbt 命令可重新运行
- wordpress - 被病毒感染的Wordpress网站;如何备份或恢复?
- python - 使用 selenium 从表中抓取数据
- javascript - 用 vue.js 调用 Nostramap Javascript?
- c++ - 如何访问标准库算法中的类私有成员?C++
- azure - 是否可以将深度学习模型与 Microsoft Bot Framework (SDK) 一起使用?
- erlang - gen_tcp:connect 将在使用 supervisor 时关闭
- python - 即使 DEBUG = True,Django 仍然在 heroku 中的 MEDIA_URL 中添加“app”
- javascript - 加入服务器时,Discord bot 未在默认频道中发送消息
- html - 如何摆脱部分之间的空白?