Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Video 在Docker中使用cvlc访问主机网络摄像头_Video_Docker_Vlc - Fatal编程技术网

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

Video 在Docker中使用cvlc访问主机网络摄像头,video,docker,vlc,Video,Docker,Vlc,我正在尝试为流媒体服务器设置Docker容器,但在尝试从容器中访问主机的网络摄像头时遇到了问题 我使用以下命令运行容器:dockerrun-t-I--privileged--rmmy/image/bin/bash。VLC拒绝以root用户身份运行,因此我在Dockerfile中创建了一个新用户 下面是我用来测试网络摄像头是否正常工作的命令: cvlc v4l2:///dev/video2:chroma=h264——sout'#std{access=file,mux=ps,dst=test.h26

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

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

下面是我用来测试网络摄像头是否正常工作的命令:

cvlc v4l2:///dev/video2:chroma=h264——sout'#std{access=file,mux=ps,dst=test.h264}'
。在主机上,一切正常

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

[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)时,我看到相同的权限被拒绝消息。是否有任何关于我可能出错的提示?

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

更多信息请点击此处: