You are not logged in.
I am using v4l2-loopback to create a virtual webcam that can be recognized by Chrome. The first time I start the loopback after rebooting everything works, but when I kill the loopback for the first time it doesn't work again. This is true if I kill it with ctrl-c or nicely by sending 'q' to ffmpeg. If I run ffmpeg the second time using sudo, it actually does work, and then doesn't work on sudo or as a normal user after that. So it seems like it works once per user, making me think some file is being created per-user and not being cleaned up correctly.
How can I turn the loopback off and on effectively?
Here is the loopback script:
#!/bin/bash
facecam_serial_id="/dev/v4l/by-id/usb-Elgato_Elgato_Facecam_FW42K1A07613-video-index0"
ffmpeg -v debug -f v4l2 -input_format uyvy422 -framerate 60 -video_size 1920x1080 -i $facecam_serial_id -pix_fmt yuyv422 -f v4l2 /dev/video9This is the ffmpeg output when it works:
https://termbin.com/h9xb
This is the ffmpeg output when it doesn't work:
https://termbin.com/5573
After killing the loopback the first time, this is the error in journalctl:
spa.v4l2: '/dev/video0' VIDIOC_QUERYCTRL: Broken pipeI use this command to test if the camera is currently working:
ffplay -f v4l2 /dev/video9This is the error from the test command when it's no longer working:
[video4linux2,v4l2 @ 0x7ff1d4000c80] Not a video capture device.
/dev/video9: No such deviceAll ideas appreciated!
Last edited by ray.s.whiteside (2022-02-08 03:32:46)
Offline
I've found the issue here:
https://thesquareplanet.com/blog/camera … -on-linux/
I’ve found the Elgato to be really finicky about allowing you to start and stop capturing. And it gets old really fast to have to plug it out and back in between each time you want to record. It turns out you can get around this really easily by doing a “soft” reset using this program.
Instructions here:
https://askubuntu.com/questions/645/how … mmand-line
My own slight contribution:
#!/bin/bash
# Sample lsusb output for Elgato Facecam
# Bus 004 Device 003: ID 0fd9:0078 Elgato Systems GmbH Elgato Facecam
facecam_vendor_id="0fd9:0078"
facecam_usb_path=$(lsusb -d $facecam_vendor_id | awk '{print "/dev/bus/usb/"$2"/"$4}' | awk '{print substr($0, 0, length($0)-1)}')
<path_to_binary>/usb_reset $facecam_usb_pathOffline