首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Docker中使用cvlc访问主机网络摄像头

在Docker中使用cvlc访问主机网络摄像头
EN

Stack Overflow用户
提问于 2014-09-10 04:19:03
回答 1查看 1.6K关注 0票数 1

我正在尝试为流媒体服务器设置Docker容器,但当我试图从容器中访问主机的网络摄像头时遇到了麻烦。

我使用以下命令运行容器:docker run -t -i --privileged --rm my/image /bin/bash。VLC拒绝以root用户身份运行,因此我在Dockerfile中创建了一个新用户。

下面是我用来测试摄像头是否正常工作的命令:cvlc v4l2:///dev/video2:chroma=h264 --sout '#std{access=file,mux=ps,dst=test.h264}'。主机上的一切都按预期运行。

当我尝试在容器中运行该命令时,我看到了以下内容:

代码语言:javascript
复制
[0x7fc300003108] mux_ps mux: Open
[0x7fc300003108] main mux debug: using sout mux module "mux_ps"
[0x7fc300000b78] main stream output debug: muxer support adding stream at any time
[0x7fc300000b78] main stream output debug: muxer prefers to wait for all ES before starting to mux
[0x7fc300000f48] stream_out_standard stream out debug: using `file/ps://test.mp4'
[0x7fc300000f48] main stream out debug: using sout stream module "stream_out_standard"
[0x7fc308000ab8] main input debug: using timeshift granularity of 50 MiB, in path '/tmp'
[0x7fc308000ab8] main input debug: `v4l2:///dev/video2:chroma=h264' gives access `v4l2' demux `' path `/dev/video2:chroma=h264'
[0x7fc308000ab8] main input debug: creating demux: access='v4l2' demux='' location='/dev/video2:chroma=h264' file='/dev/video2:chroma=h264'
[0x7fc300004088] main demux debug: looking for access_demux module matching "v4l2": 20 candidates
[0x7fc300004088] v4l2 demux debug: opening device '/dev/video2'
[0x7fc300004088] v4l2 demux error: cannot open device '/dev/video2': Permission denied
[0x7fc300004088] v4l2 demux debug: opening device '/dev/video2'
[0x7fc300004088] v4l2 demux error: cannot open device '/dev/video2': Permission denied
[0x7fc300004088] main demux debug: no access_demux modules matched
[0x7fc308000ab8] main input debug: creating access 'v4l2' location='/dev/video2:chroma=h264', path='/dev/video2:chroma=h264'
[0x7fc300005988] main access debug: looking for access module matching "v4l2": 25 candidates
[0x7fc300005988] v4l2 access debug: opening device '/dev/video2'
[0x7fc300005988] v4l2 access error: cannot open device '/dev/video2': Permission denied
[0x7fc300005988] main access debug: no access modules matched
[0x7fc308000ab8] main input error: open of `v4l2:///dev/video2:chroma=h264' failed
[0x7fc308000ab8] main input error: Your input can't be opened
[0x7fc308000ab8] main input error: VLC is unable to open the MRL 'v4l2:///dev/video2:chroma=h264'. Check the log for details.
[0x927218] main playlist debug: dead input

当我尝试运行类似的工具如ffmpeg时,我看到了相同的权限被拒绝的消息。有没有提示我可能出错的地方?

EN

回答 1

Stack Overflow用户

发布于 2014-09-11 02:47:56

问题是我的用户不是video组的成员。此外,我还必须将视频设备的权限更改为root.video

更多信息请点击此处:http://www.tldp.org/HOWTO/html_single/Webcam-HOWTO/#PERMISSIONS

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25752951

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档