V4L2 웹캠을 사용중인 프로세스를 어떻게 알 수 있습니까? Device or resource busy libv4l2:

나는 다음을 실행하려고 시도했다.

$ vlc -I dummy v4l2:///dev/video0 --video-filter scene --no-audio --scene-path webcam.png --scene-prefix image_prefix --scene-format png vlc://quit --run-time=1
VLC media player 2.0.7 Twoflower (revision 2.0.6-54-g7dd7e4d)
[0x1f4a1c8] dummy interface: using the dummy interface module...
[0x7fc19c001238] v4l2 demux error: VIDIOC_STREAMON failed
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
[0x7fc19c007f18] v4l2 access error: cannot set input 0: Device or resource busy
[0x7fc19c007f18] v4l2 access error: cannot set input 0: Device or resource busy
[0x7fc1a4000b28] main input error: open of `v4l2:///dev/video0' failed
[0x7fc1a4000b28] main input error: Your input can't be opened
[0x7fc1a4000b28] main input error: VLC is unable to open the MRL 'v4l2:///dev/video0'. Check the log for details.
[0x7fc19c007cc8] idummy demux: command `quit'

그래서 현재 웹캠에 액세스하는 프로그램이 있다고 가정하고 있는데, 불이 꺼지고 lsof | grep /dev/video아무것도 반환하지 않기 때문에 번거 롭습니다 . 현재 웹캠을 사용중인 프로세스를 확인하는 다른 적절한 방법이 있습니까? 아니면 완전히 다른 성격의 문제입니까?



답변

나는 같은 문제를 겪고 있었고 http://www.theoutpost.org/8-nslu2/open-devvideo0-device-or-resource-busy/ (EDIT : url updated) 의 솔루션이
도움이되었습니다.

$ fuser /dev/video0
/dev/video0: 1871m
$ ps axl | grep 1871
$ kill -9 1871

답변

어떤 이유로 Tsan-Kuang의 답변에서 / dev / video *가 작동하지 않았습니다. 기기에 연결할 수있는 다른 방법은 다음과 같습니다 ls /dev/input/by-id/.. 예를 들면 다음과 같습니다.

$ fuser /dev/input/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-5000-event-if00


답변

이 명령은 장치를 사용하는 모든 프로세스를 반환합니다.

$ lsof /dev/video0
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
cheese  31526 kirill  mem    CHR   81,0          18321 /dev/video0
cheese  31526 kirill   23u   CHR   81,0      0t0 18321 /dev/video0

이 샘플에서 PID를 사용하면 프로세스를 종료 할 수 있습니다.

$ kill 31526