我最近才注意到,只要有其他程序访问我的网络摄像头的视频,它就并不总是在程序中播放。
让我们通过一些用法示例来解释这一点:
我正在运行 uTox(毒我在后台运行一个即时通讯客户端,以便我可以接收来自朋友和客户的安全消息,突然我接到一个 Skype 电话。Skype 无法访问网络摄像头,因为 uTox 已控制该设备。
uTox 正在运行,我想使用 Cheese 检查我的网络摄像头的视频输出。我收到错误:
There was an error playing video from the webcam
并且没有视频输出。
在这两种情况下,uTox 都不会触发我笔记本电脑上的网络摄像头灯,而且它不应该主动使用网络摄像头(它只是出于某种原因暂停了设备)。为了绕过这个问题,我想知道我是否可以做任何事情让多个程序同时访问摄像头(或者对于熟悉客户端的人来说,我如何从 uTox 中删除对视频的暂停?),因为我通常需要让 uTox 在后台运行。为了接听 Skype 电话而终止进程非常不方便。
有没有任何我可以允许多个程序同时访问同一个视频设备吗?
运行 Cheese 时出错:
$ cheese &
...
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
(cheese:8259): cheese-WARNING **: Device '/dev/video0' is busy: gstv4l2object.c(2838): gst_v4l2_object_set_format (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin18/GstV4l2Src:video_source:
Call to S_FMT failed for YU12 @ 1280x720: Device or resource busy
系统信息:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
# lshw -short
H/W path Device Class Description
======================================================
system Computer
/0 bus Motherboard
/0/0 memory 7873MiB System memory
/0/1 processor Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz
/0/100 bridge 3rd Gen Core processor DRAM Controller
/0/100/2 display 3rd Gen Core processor Graphics Controller
/0/100/14 bus 7 Series/C210 Series Chipset Family USB xHCI Host Controller
/0/100/14/0 usb2 bus xHCI Host Controller
/0/100/14/1 usb1 bus xHCI Host Controller
/0/100/16 communication 7 Series/C210 Series Chipset Family MEI Controller #1
/0/100/1a bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
/0/100/1a/1 usb3 bus EHCI Host Controller
/0/100/1a/1/1 bus Integrated Rate Matching Hub
/0/100/1a/1/1/1 communication Bluetooth wireless interface
/0/100/1a/1/1/3 multimedia HD WebCam
/0/100/1b multimedia 7 Series/C210 Series Chipset Family High Definition Audio Controller
/0/100/1c bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 1
/0/100/1c/0 eth0 network NetXtreme BCM57786 Gigabit Ethernet PCIe
/0/100/1c/0.1 generic BCM57765/57785 SDXC/MMC Card Reader
/0/100/1c.1 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 2
/0/100/1c.1/0 wlan0 network QCA9565 / AR9565 Wireless Network Adapter
/0/100/1d bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
/0/100/1d/1 usb4 bus EHCI Host Controller
/0/100/1d/1/1 bus Integrated Rate Matching Hub
/0/100/1f bridge HM77 Express Chipset LPC Controller
/0/100/1f.2 storage 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
/0/100/1f.3 bus 7 Series/C210 Series Chipset Family SMBus Controller
...
请注意,此处涉及的视频设备是lshw
位于/dev/video0