Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
2742 views
v4l2loopback: Virtual camera exists, but doesn't show up in Zoom, and doesn't work in Cheese
I have successfully set up the virtual camera in OBS: sudo apt install obs-studio v4l2loopback-dkms sudo usermod -aG video myuser The following versions are installed: v4l2loopback-dkms 0.12.5-1 obs-studio 26.1.2+dfsg1-1~ubuntu20.10.1~ppa1 Kernel: 5.11.0-11-lowlatency After a reboot, the virtual cam...
I have successfully set up the virtual camera in OBS: sudo apt install obs-studio v4l2loopback-dkms sudo usermod -aG video myuser The following versions are installed: v4l2loopback-dkms 0.12.5-1 obs-studio 26.1.2+dfsg1-1~ubuntu20.10.1~ppa1 Kernel: 5.11.0-11-lowlatency After a reboot, the virtual camera button and settings are showing up in OBS, and clicking the start button creates the following CLI output: info: Virtual camera started info: ==== Virtual Camera Start ========================================== It also seems to work according to v4l2-ctl: $ v4l2-ctl --list-devices OBS Virtual Camera (platform:v4l2loopback-000): /dev/video6 USB 2.0 Camera: USB 2.0 Camera (usb-0000:00:14.0-4.2): /dev/video4 /dev/video5 /dev/media2 Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-6): /dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/media0 /dev/media1 After changing the refresh rate in OBS -> Settings -> Video to **30 fps**, the virtual camera also shows up in **Cheese**, but selecting it there, Cheese can not use it and displays an error There was an error playing video from the webcam. Cheese does not create any CLI output. In **Zoom**, the virtual camera does not show up in the selection menu at all. I also experimented with different **color format** settings in OBS -> Settings -> Advanced, but to no avail, it doesn't affect the outcome. Any idea what could be a reason? [Update:] The virtual camera works when using VLC. This to me indicates a problem with the output format. However, I have tested all possible output resolutions, frame rates, and color formats offered by OBS, and none work with Cheese or Zoom.
knipknap (111 rep)
Apr 11, 2021, 10:08 AM • Last activity: Jun 17, 2025, 01:10 AM
1 votes
1 answers
42 views
Do v4l2loopback virtual video loopback devices support metadata streams?
I'm trying to attach timestamp metadata to the virtual loopback devices I've spun up. However, when I use the VIDIOC_QUERYCAP() ioctl (https://www.kernel.org/doc/html/v5.2/media/uapi/v4l/dev-meta.html), and look at the device_caps and capabilities fields, the bits for V4L2_CAP_META_OUTPUT and V4L2_C...
I'm trying to attach timestamp metadata to the virtual loopback devices I've spun up. However, when I use the VIDIOC_QUERYCAP() ioctl (https://www.kernel.org/doc/html/v5.2/media/uapi/v4l/dev-meta.html) , and look at the device_caps and capabilities fields, the bits for V4L2_CAP_META_OUTPUT and V4L2_CAP_META_CAPTURE (https://dri.freedesktop.org/docs/drm/media/uapi/v4l/vidioc-querycap.html#device-capabilities) are both off. Is there a way to create a virtual video loopback device that does support the metadata interface?
Adir (11 rep)
Apr 23, 2025, 08:07 PM • Last activity: Apr 29, 2025, 01:57 PM
1 votes
0 answers
309 views
OBS Studio Virtual Camera: Failed to start streaming on '/dev/video2'
Distribution: Arch Linux OBS Version: 31.0.3 Kernel Version: 6.14.2-arch1-1 v4l2loopback-utils Version: 0.14.0-1 vulkan-radeon Version: 25.0.3-1 ``` > v4l2-ctl --list-devices OBS Virtual Camera (platform:v4l2loopback-000): /dev/video2 Laptop Camera: Laptop Camera (usb-0000:c4:00.4-1): /dev/video0 /d...
Distribution: Arch Linux OBS Version: 31.0.3 Kernel Version: 6.14.2-arch1-1 v4l2loopback-utils Version: 0.14.0-1 vulkan-radeon Version: 25.0.3-1
> v4l2-ctl --list-devices
OBS Virtual Camera (platform:v4l2loopback-000):
    /dev/video2

Laptop Camera: Laptop Camera (usb-0000:c4:00.4-1):
    /dev/video0
    /dev/video1
    /dev/media0
When I click "Start Virtual Camera" on OBS Studio I get the "Failed to start virtual camera" error. Checking the logs, I see "Failed to start streaming on '/dev/video2' (Invalid argument)." I tried downgrading to 0.13.2-1.
> sudo downgrade v4l2loopback-dkms
> sudo downgrade v4l2loopback-utils
> sudo rmmod -f v4l2loopback
> sudo modprobe v4l2loopback
I could start the Virtual Camera, but Google Meet and other conferencing software could not detect my virtual camera anymore. also some other programs need v4l2 so I can no longer keep it in the downgraded state. Are there any fixes other than waiting for OBS to correct their code?
Hyunbin Yoo (175 rep)
Apr 16, 2025, 06:48 PM • Last activity: Apr 18, 2025, 05:36 PM
2 votes
0 answers
208 views
UVC Simulated Webcam Not Recognized as USB Device on Raspberry Pi Zero 2W
I am trying to create a USB device that can be plugged in to a computer and will appear as a webcam, but instead of having a camera, it will stream video from an MP4 file on the device filesystem. The issue I am facing is the device is not showing up as a USB device when I plug it in to my Mac. I am...
I am trying to create a USB device that can be plugged in to a computer and will appear as a webcam, but instead of having a camera, it will stream video from an MP4 file on the device filesystem. The issue I am facing is the device is not showing up as a USB device when I plug it in to my Mac. I am using a Raspberry Pi Zero 2W. I have tried this on Raspberry Pi OS (Full and Lite) which is Debian Bookworm as well as on Ubuntu 24.10. I have a script that is running and using v4l2loopback to create a virtual camera as /dev/video0 and I am binding the controller in the script to the UDC. When I run "v4l2-ctl --list-devices": 3f980000.usb (gadget.0): /dev/video1 VirtualCam (platform:v4l2loopback-000): /dev/video0 Once the setup is done, I run: "
-gadget2 -d /dev/video1 -u /dev/video0 -r 1 -f 1
" (this is from https://github.com/wlhe/uvc-gadget) Output:
uvc device is VirtualCam on bus platform:v4l2loopback-000
uvc open succeeded, file descriptor = 3
(continues running in foreground)
While the last command appears to be running, **there is still no USB UVC device appearing on my Mac.** I **was** able to get this device to simulate a virtual ethernet adapter by loading g_ether in the /boot/firmware/cmdline.txt and /etc/modules and then rebooting the device and plugging it in. **My mac saw it as a new USB ethernet adapter**, so I know I am using a good data/power cable and the device is configured properly to be otg / peripheral in config.txt. What am I missing here? My script is below.
#!/bin/bash

# Variables we need to make things easier later on.

CONFIGFS="/sys/kernel/config"
GADGET="$CONFIGFS/usb_gadget"
VID="0x0525"
PID="0xa4a2"
SERIAL="0123456789"
MANUF=$(hostname)
PRODUCT="UVC Gadget"
BOARD=$(strings /proc/device-tree/model)
UDC=ls /sys/class/udc # will identify the 'first' UDC

# Later on, this function is used to tell the usb subsystem that we want
# to support a particular format, framesize and frameintervals
create_frame() {
    # Example usage:
    # create_frame      

    FUNCTION=$1
    WIDTH=$2
    HEIGHT=$3
    FORMAT=$4
    NAME=$5

    wdir=functions/$FUNCTION/streaming/$FORMAT/$NAME/${HEIGHT}p

    mkdir -p $wdir
    echo $WIDTH > $wdir/wWidth
    echo $HEIGHT > $wdir/wHeight
    echo $(( $WIDTH * $HEIGHT * 2 )) > $wdir/dwMaxVideoFrameBufferSize
    cat  $wdir/dwFrameInterval
$6
EOF
}

# This function sets up the UVC gadget function in configfs and binds us
# to the UVC gadget driver.
create_uvc() {
    CONFIG=$1
    FUNCTION=$2

    echo "    Creating UVC gadget functionality : $FUNCTION"
    mkdir functions/$FUNCTION

    create_frame $FUNCTION 640 480 uncompressed u "333333
416667
500000
666666
1000000
1333333
2000000
"
    create_frame $FUNCTION 1280 720 uncompressed u "1000000
1333333
2000000
"
    create_frame $FUNCTION 1920 1080 uncompressed u "2000000"
    create_frame $FUNCTION 640 480 mjpeg m "333333
416667
500000
666666
1000000
1333333
2000000
"
    create_frame $FUNCTION 1280 720 mjpeg m "333333
416667
500000
666666
1000000
1333333
2000000
"
    create_frame $FUNCTION 1920 1080 mjpeg m "333333
416667
500000
666666
1000000
1333333
2000000
"

    mkdir functions/$FUNCTION/streaming/header/h
    cd functions/$FUNCTION/streaming/header/h
    ln -s ../../uncompressed/u
    ln -s ../../mjpeg/m
    cd ../../class/fs
    ln -s ../../header/h
    cd ../../class/hs
    ln -s ../../header/h
    cd ../../class/ss
    ln -s ../../header/h
    cd ../../../control
    mkdir header/h
    ln -s header/h class/fs
    ln -s header/h class/ss
    cd ../../../

    # This configures the USB endpoint to allow 3x 1024 byte packets per
    # microframe, which gives us the maximum speed for USB 2.0. Other
    # valid values are 1024 and 2048, but these will result in a lower
    # supportable framerate.
    echo 2048 > functions/$FUNCTION/streaming_maxpacket

    ln -s functions/$FUNCTION configs/c.1
}

# This loads the module responsible for allowing USB Gadgets to be
# configured through configfs, without which we can't connect to the
# UVC gadget kernel driver

##########################
# RDS
# First, Unload existing video hardware
modprobe -r bcm2835_v4l2
modprobe -r bcm2835_codec
modprobe -r bcm2835_isp

# Then load the loopback as video0
modprobe v4l2loopback devices=1 video_nr=0 card_label="VirtualCam" exclusive_caps=1

# Ensure that video0 is there
ls /dev/video*
##########################

echo "Loading composite module"
modprobe libcomposite

# This section configures the gadget through configfs. We need to
# create a bunch of files and directories that describe the USB
# device we want to pretend to be.

if
[ ! -d $GADGET/g1 ]; then
    echo "Detecting platform:"
    echo "  board : $BOARD"
    echo "  udc   : $UDC"

    echo "Creating the USB gadget"

    echo "Creating gadget directory g1"
    mkdir -p $GADGET/g1

    cd $GADGET/g1
    if
[ $? -ne 0 ]; then
        echo "Error creating usb gadget in configfs"
        exit 1;
    else
        echo "OK"
    fi

    echo "Setting Vendor and Product ID's"
    echo $VID > idVendor
    echo $PID > idProduct
    echo "OK"

    echo "Setting English strings"
    mkdir -p strings/0x409
    echo $SERIAL > strings/0x409/serialnumber
    echo $MANUF > strings/0x409/manufacturer
    echo $PRODUCT > strings/0x409/product
    echo "OK"

    echo "Creating Config"
    mkdir configs/c.1
    mkdir configs/c.1/strings/0x409

    echo "Creating functions..."

    create_uvc configs/c.1 uvc.0

    echo "OK"

    echo "Binding USB Device Controller"
    echo $UDC > UDC
    echo "OK"
fi
Richard Schramnm (21 rep)
Dec 8, 2024, 09:35 PM
4 votes
2 answers
661 views
I want to write a script that simultaneously renders what's on my webcam to a window on my screen and records a video
I have tried a combination of: * v4l2loopback * ffmpeg * mpv But either the web-cam view, or the web-cam record works, but never both together. Can anyone provide a script that achieves this? This is what I've tried so far: ```bash #!/usr/bin/env bash set -x # This needs the video loopback module to...
I have tried a combination of: * v4l2loopback * ffmpeg * mpv But either the web-cam view, or the web-cam record works, but never both together. Can anyone provide a script that achieves this? This is what I've tried so far:
#!/usr/bin/env bash

set -x

# This needs the video loopback module to be installed.
# sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="VirtualCam" exclusive_caps=1

# use pw-cli list-objects | grep node.name to get the audio device
AUDIO_DEVICE="alsa_input.pci-0000_00_1f.3.analog-stereo"
VIDEO_DEVICE="/dev/video0"
VIRTUAL_VIDEO_DEVICE="/dev/video10"

read -p "Enter a name for the video: " VIDEO_NAME

if [ -z "$VIDEO_NAME" ]; then
    VIDEO_NAME="unnamed_video"
fi

OUTPUT_FILE="$HOME/videos/${VIDEO_NAME}_$(date +%Y%m%d_%H%M%S).mkv"

trap 'echo "Stopping recording..."; pkill -P $$; exit 0' SIGINT

ffmpeg -f v4l2 -framerate 30 -video_size 640x480 -i "$VIDEO_DEVICE" \
    -f v4l2 -video_size 640x480 -i "$VIRTUAL_VIDEO_DEVICE" &

sleep 2

# Start displaying the virtual webcam feed with mpv
mpv --no-osc \
    --no-input-default-bindings \
    --profile=low-latency \
    --geometry=50%:50% \
    --autofit=100% \
    --input-conf=/dev/null \
    --title='WebcamDisplay' \
    --framedrop=no \
    --vf=scale=640:-1 \
    --vo=vaapi \
    "$VIRTUAL_VIDEO_DEVICE" &

# Start recording from the virtual device with ffmpeg
ffmpeg -f v4l2 -framerate 30 -video_size 640x480 -i "$VIRTUAL_VIDEO_DEVICE" \
    -f pulse -i "$AUDIO_DEVICE" \
    -c:v libx264 -preset ultrafast -crf 28 -pix_fmt yuv420p \
    -c:a aac -b:a 192k -ar 48000 \
    "$OUTPUT_FILE"

# Stop all processes when done
pkill ffmpeg
pkill mpv
This is my loopback setup:
$ v4l2-ctl --list-devices
VirtualCam (platform:v4l2loopback-010):
        /dev/video10

Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-12):
        /dev/video0
        /dev/video1
        /dev/media0
Brad (331 rep)
Sep 10, 2024, 11:24 AM • Last activity: Nov 24, 2024, 02:16 PM
1 votes
1 answers
96 views
Open v4l2loopback device with O_NONBLOCK
I'm writing a python library called [linuxpy](https://github.com/tiagocoutinho/linuxpy) which supports V4L2. One of the features is being able to open de V4L2 device in non blocking mode (`O_NONBLOCK`) to be cooperative with python `async`/`await`. I tried with several real cameras and everything se...
I'm writing a python library called [linuxpy](https://github.com/tiagocoutinho/linuxpy) which supports V4L2. One of the features is being able to open de V4L2 device in non blocking mode (O_NONBLOCK) to be cooperative with python async/await. I tried with several real cameras and everything seems to work properly. But when I test v4l2loopback device it blocks waiting for the first frame if I open the v4l2loopback device with O_NONBLOCK. Does anyone know if v4l2loopback supports O_NONBLOCK?
Tiago Coutinho (111 rep)
Jul 9, 2024, 04:01 PM • Last activity: Nov 11, 2024, 12:13 AM
2 votes
1 answers
175 views
How can I mock up a screen share?
I can use v4l2loopback to create a dummy video device, Xephyr to create a nested X server in its own window, and a gst pipeline to link the two so that the contents of the Xephyr window appear as my webcam. This gives a nice sandbox where only the applications I want to share are made visible, and i...
I can use v4l2loopback to create a dummy video device, Xephyr to create a nested X server in its own window, and a gst pipeline to link the two so that the contents of the Xephyr window appear as my webcam. This gives a nice sandbox where only the applications I want to share are made visible, and it means that I can switch back to the video conference without the other participants losing the view of the nested desktop. However, this appears as my webcam, not as a screen share, and so I lose some desirable aspects of true screen sharing. For instance, it means that each other user has to "pin" my feed in order that it doesn't lose focus when someone else speaks. So I'm searching for a way to fool my browser into taking its screen share input from an X server other than the one in which it's running, or from a video device. In case it matters, this is Firefox running in a Cinnamon environment.
Aoeuid (123 rep)
Nov 1, 2024, 03:08 PM • Last activity: Nov 1, 2024, 03:30 PM
0 votes
1 answers
340 views
Using OBS with Virtual Camera on Debian Bookworm
I just installed OBS on Debian Bookworm and two things became apparent immediately: 1. "Screen Capture" only outputs a black screen. 2. There is no button under "Controls" for starting the virtual camera. How can OBS be made usable? [![OBS issues][1]][1] [1]: https://i.sstatic.net/MBlQauOp.png
I just installed OBS on Debian Bookworm and two things became apparent immediately: 1. "Screen Capture" only outputs a black screen. 2. There is no button under "Controls" for starting the virtual camera. How can OBS be made usable? OBS issues
Wilfred Montoya (173 rep)
Aug 18, 2024, 04:45 AM • Last activity: Sep 13, 2024, 06:48 AM
3 votes
1 answers
10142 views
How to best install v4l2loopback on Linux Mint?
I am trying to create a virtual webcam from OBS(26.1.1) so I can feed it to Zoom. I am Linux Mint 20.1 Cinnamon, version 4.8.6, Kernel 5.4.0-64-generic. I did: sudo apt-get install v4l2loopback-dkms sudo apt-get install v4l2loopback-utils but v4l2loopback is not showing up as an option in zoom I wen...
I am trying to create a virtual webcam from OBS(26.1.1) so I can feed it to Zoom. I am Linux Mint 20.1 Cinnamon, version 4.8.6, Kernel 5.4.0-64-generic. I did: sudo apt-get install v4l2loopback-dkms sudo apt-get install v4l2loopback-utils but v4l2loopback is not showing up as an option in zoom I went to the v4l2loopback github page, where it suggested I should build it from scratch and install it into my kernel. I tried to build from scratch and immediately ran into problems with the make command. make -C /lib/modules/uname -r/build M=/home/berggren/Downloads/v4l2loopback-main modules make: Entering directory '/usr/src/linux-headers-5.4.0-64-generic' Building modules, stage 2. MODPOST 1 modules make: Leaving directory '/usr/src/linux-headers-5.4.0-64-generic' make -C utils make: Entering directory '/home/berggren/Downloads/v4l2loopback-main/utils' cc -I.. v4l2loopback-ctl.c -o v4l2loopback-ctl v4l2loopback-ctl.c:1:10: fatal error: sys/types.h: No such file or directory 1 | #include | ^~~~~~~~~~~~~ compilation terminated. make: *** [: v4l2loopback-ctl] Error 1 make: Leaving directory '/home/berggren/Downloads/v4l2loopback-main/utils' make: *** [Makefile:85: utils/v4l2loopback-ctl] Error 2 I didn't go further because I wasn't sure I was going in the right direction with that. Could someone explain the correct procedure for installing v4l2loopback?
Karl Berggren (43 rep)
Feb 20, 2021, 02:51 PM • Last activity: Jun 13, 2024, 08:56 AM
0 votes
1 answers
202 views
Virtual Camera on OBS is Flipped
When I use the Virtual Camera on OBS with `v4l2loopback` it is flipping the video in the x-axis. Is there a way to reverse it back to normal?
When I use the Virtual Camera on OBS with v4l2loopback it is flipping the video in the x-axis. Is there a way to reverse it back to normal?
Eduardo Chaves (1 rep)
Sep 16, 2022, 05:12 PM • Last activity: Apr 18, 2024, 10:36 PM
1 votes
1 answers
505 views
dkms install v4l2loopback-dc/2.1.2 fails
While updating my Archlinux packages with `_ packman -Syu`, I see that dkms fails to install modules: ``` (11/23) Install DKMS modules ==> dkms install --no-depmod v4l2loopback-dc/2.1.2 -k 6.8.5-arch1-1 Error! Bad return status for module build on kernel: 6.8.5-arch1-1 (x86_64) Consult /var/lib/dkms...
While updating my Archlinux packages with _ packman -Syu, I see that dkms fails to install modules:
(11/23) Install DKMS modules
==> dkms install --no-depmod v4l2loopback-dc/2.1.2 -k 6.8.5-arch1-1
Error! Bad return status for module build on kernel: 6.8.5-arch1-1 (x86_64)
Consult /var/lib/dkms/v4l2loopback-dc/2.1.2/build/make.log for more information.
==> WARNING: `dkms install --no-depmod v4l2loopback-dc/2.1.2 -k 6.8.5-arch1-1' exited 10
==> dkms install --no-depmod v4l2loopback/0.13.1 -k 6.8.5-arch1-1
==> depmod 6.8.5-arch1-1
(12/23) Updating TeXLive filename database...
In the log file (translated):
DKMS make.log for v4l2loopback-dc-2.1.2 for kernel 6.8.5-arch1-1 (x86_64)
Tue 16 Apr 2024 07:56:42 +03
make -C /lib/modules/6.8.5-arch1-1/build M=/var/lib/dkms/v4l2loopback-dc/2.1.2/build modules
make: enter directory "/usr/lib/modules/6.8.5-arch1-1/build"
   CC [M] /var/lib/dkms/v4l2loopback-dc/2.1.2/build/v4l2loopback-dc.o
/var/lib/dkms/v4l2loopback-dc/2.1.2/build/v4l2loopback-dc.c: In the "vidioc_querycap" function:
/var/lib/dkms/v4l2loopback-dc/2.1.2/build/v4l2loopback-dc.c:622:3: error: implicit function declaration 'strlcpy'; did you mean "strscpy"? [-Werror=implicit-function-declaration]
   622 | strlcpy(cap->driver, "Droidcam", sizeof(cap->driver));
       | ^~~~~~~
       | strscpy
cc1: some warnings are considered errors
make: *** [scripts/Makefile.build:243: /var/lib/dkms/v4l2loopback-dc/2.1.2/build/v4l2loopback-dc.o] Error 1
make: *** [/usr/lib/modules/6.8.5-arch1-1/build/Makefile:1921: /var/lib/dkms/v4l2loopback-dc/2.1.2/build] Error 2
make: *** [Makefile:240: __sub-make] Error 2
make: exit from the directory "/usr/lib/modules/6.8.5-arch1-1/build"
make: *** [Makefile:8: all] Error 2
Is it a bug inside v4l2loopback source code or is it wrong dependencies? Thanks
Artyom (301 rep)
Apr 16, 2024, 05:08 AM • Last activity: Apr 16, 2024, 08:57 AM
0 votes
0 answers
1082 views
How to get v4l2loopback to work on Android, emulate webcam?
[![enter image description here][1]][1] Several weeks, like WhatsApp web, 2chat API etc., Require one to scan a barcode on another device to active it. To get around this on an Android one should be able to make a virtual webcam that is really a video of the qr code Several questions on the Android...
enter image description here Several weeks, like WhatsApp web, 2chat API etc., Require one to scan a barcode on another device to active it. To get around this on an Android one should be able to make a virtual webcam that is really a video of the qr code Several questions on the Android stack exchange led to the library v4l2loopback, but in the docs I couldn't figure out yet how to get it to work for Android devices. How can I use the v4l2loopback lifeway for Android? No answer: https://android.stackexchange.com/questions/145020/how-to-emulate-camera-input-in-android-to-activate-whatsapp-web https://android.stackexchange.com/questions/110505/creating-fake-microphone-and-camera-inputs-on-an-android-mobile On that latter question there is a comment, that lead me here: > This kernel module looks relevant (github.com/umlaeute/v4l2loopback) It doesn't seem like it was ever compiled for Android at the moment, but since Android is Linux based it would be possible.
Awtsmoos--עצמות (101 rep)
Apr 8, 2024, 03:26 PM • Last activity: Apr 8, 2024, 04:07 PM
5 votes
1 answers
2751 views
v4l2loopback devices not showing in applications
I have been successfully using v4l2loopback, with v4l2sink in OBS, to "send" my obs preview panel output to Zoom. The v4l2loopback devices have recently stopped showing in Zoom, Firefox & Brave. However, I can confirm the loopback is viewable in VLC. I'm on: - Pop!_OS (20.10) - v4l2loopback-dkms (0....
I have been successfully using v4l2loopback, with v4l2sink in OBS, to "send" my obs preview panel output to Zoom. The v4l2loopback devices have recently stopped showing in Zoom, Firefox & Brave. However, I can confirm the loopback is viewable in VLC. I'm on: - Pop!_OS (20.10) - v4l2loopback-dkms (0.12.5-1) - OBS (with the v4l2sink plug-in) (26.0.2+dfsg1-1) - Zoom (5.4.3) I normally start the loopback device with the following: sudo modprobe v4l2loopback video_nr=99 card_label="OBS Video Source" exclusive_caps=1 This is usually run on boot via: $ cat /etc/modprobe.d/v4l2loopback.conf options v4l2loopback video_nr=99 card_label="OBS Video Source" exclusive_caps=1 $ cat /etc/modules-load.d/v4l2loopback.conf v4l2loopback The device shows via v4l2-ctl: v4l2-ctl --list-devices OBS Video Source (platform:v4l2loopback-000): /dev/video99 Cam Link 4K: Cam Link 4K (usb-0000:06:00.1-4): /dev/video2 /dev/video3 UVC Camera (046d:0990) (usb-0000:06:00.3-1): /dev/video0 /dev/video1 and once I start the v4l2sink in OBS, I can view this in VLC. However, as mentioned, the OBS Video Source device is no longer showing up in any applications that I've tried, as a selectable source. How can I get the OBS Video Source show up as a source in Zoom again?
Gaynor Cosgrove (51 rep)
Nov 25, 2020, 01:41 PM • Last activity: Mar 20, 2024, 06:45 AM
0 votes
1 answers
311 views
Issues compiling V4L2loopback on raspberry pi bookworm
I installed the latest version of raspios, here is the uname -a Linux raspberrypi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux I git cloned V4l2loopback and tried compiling after getting the linux headers. I get the following error. Building v4l2-loopback driver... make -C /lib/modules...
I installed the latest version of raspios, here is the uname -a Linux raspberrypi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux I git cloned V4l2loopback and tried compiling after getting the linux headers. I get the following error. Building v4l2-loopback driver... make -C /lib/modules/uname -r/build M=/home/pi/v4l2loopback KCPPFLAGS="-DSNAPSHOT_VERSION='"0.12.7-412-g850a2e3"'" modules make: Entering directory '/usr/src/linux-headers-6.1.21+' CC [M] /home/pi/v4l2loopback/v4l2loopback.o MODPOST /home/pi/v4l2loopback/Module.symvers ERROR: modpost: "__aeabi_ldivmod" [/home/pi/v4l2loopback/v4l2loopback.ko] undefined! make: *** [scripts/Makefile.modpost:126: /home/pi/v4l2loopback/Module.symvers] Error 1 make: *** [Makefile:1964: modpost] Error 2 make: Leaving directory '/usr/src/linux-headers-6.1.21+' make: *** [Makefile:53: v4l2loopback.ko] Error 2 I googled and found that is error mostly shows up when you do 64 bit division on 32 bit. I looked through the code and found instances of divisions with 64 bit and I tried to replace it with do_div() but to no avail. I get a whole bunch of other errors when I do that. How do you fix this issue?
Anil (1 rep)
Dec 12, 2023, 09:34 PM • Last activity: Dec 12, 2023, 09:50 PM
0 votes
0 answers
81 views
Replacing Phone Internal Camera with Video Footage using v4l2loopback
I'm currently exploring the possibility of replacing my phone's internal camera feed with video footage using v4l2loopback. My goal is to have applications on my phone use a predefined video as if it were the live camera feed. I have a few questions: Procedure: Could someone guide me through the ste...
I'm currently exploring the possibility of replacing my phone's internal camera feed with video footage using v4l2loopback. My goal is to have applications on my phone use a predefined video as if it were the live camera feed. I have a few questions: Procedure: Could someone guide me through the steps to achieve this using v4l2loopback? Any specific commands or configurations I need to be aware of? Application Compatibility: Will this replacement apply to all apps that use the camera, or are there limitations? I'm particularly interested in knowing if common camera-dependent applications will seamlessly work with the video feed.
Jessica (1 rep)
Nov 19, 2023, 07:28 PM • Last activity: Nov 19, 2023, 11:20 PM
0 votes
1 answers
212 views
Chromium cannot read camera: Dequeued v4l2 buffer contains invalid length #561
I installed the v4l2loopback kernel module on my machine and enabled it with ``sudo modprobe v4l2loopback exclusive_caps=1``. I created a camera on ``/dev/video0`` with [the rust bindings](https://docs.rs/v4l2loopback/latest/v4l2loopback/) and started piping a static image to the camera (command fro...
I installed the v4l2loopback kernel module on my machine and enabled it with `sudo modprobe v4l2loopback exclusive_caps=1`. I created a camera on `/dev/video0` with [the rust bindings](https://docs.rs/v4l2loopback/latest/v4l2loopback/) and started piping a static image to the camera (command from [the wiki](https://github.com/umlaeute/v4l2loopback/wiki/FFmpeg)) :
sudo ffmpeg -loop 1 -re -i 60828015.jpg -f v4l2 -vcodec rawvideo -pix_fmt yuv420p /dev/video0
I'm running this on a VPS with no desktop environment, so I quickly spun up a Docker container with noVNC and a desktop environment to test everything (`sudo docker run --rm -it --device /dev/video0 --privileged -p 8090:8080 theasp/novnc). Everything looks fine and if i run ffplay /dev/video0`, I can successfully view the image in the camera. The problem now is with other applications. Cheese doesn't even detect the camera. Chromium detects the camera but cannot use it:
[15749:15755:1024/025614.520951:ERROR:v4l2_capture_delegate.cc(1138)] Dequeued v4l2 buffer contains invalid length (11441 bytes).
Not sure what I'm doing wrong and why Chromium cannot read from the camera. - kernel version: 5.4.0-164-generic - v4l2loopback version: commit 5bb9bed on the main branch (latest one right now) - module paramaters: exclusive_caps=1 FFmpeg pipe logs:
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, image2, from 'input.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1854 kb/s
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 360x287 [SAR 96:96 DAR 360:287], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[swscaler @ 0x55b19c9fab80] deprecated pixel format used, make sure you did set range correctly
Output #0, video4linux2,v4l2, to '/dev/video0':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 360x287 [SAR 1:1 DAR 360:287], q=2-31, 30996 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.54.100 rawvideo
frame= 2277 fps= 25 q=-0.0 size=N/A time=00:01:31.08 bitrate=N/A speed=   1x
asdfasdf (101 rep)
Oct 28, 2023, 12:02 AM • Last activity: Oct 31, 2023, 08:18 PM
0 votes
0 answers
627 views
RuntimeError: 'v4l2loopback' backend: std::exception
I'm getting above error when I'm trying to execute following piece of code: import pyvirtualcam import numpy as np with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam: print(f'Using virtual camera: {cam.device}') frame = np.zeros((cam.height, cam.width, 3), np.uint8) # RGB while True: fr...
I'm getting above error when I'm trying to execute following piece of code: import pyvirtualcam import numpy as np with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam: print(f'Using virtual camera: {cam.device}') frame = np.zeros((cam.height, cam.width, 3), np.uint8) # RGB while True: frame[:] = cam.frames_sent % 255 # grayscale animation cam.send(frame) cam.sleep_until_next_frame() I'm running this on raspberry pi (Kernel version: 5.10 and raspberrypi-kernel-headers version is 1:1.20210527-1). Error: Traceback (most recent call last): File "", line 1, in File "/home/pi/.local/lib/python3.7/site-packages/pyvirtualcam/camera.py", line 219, in __init__ raise RuntimeError('\n'.join(errors)) RuntimeError: 'v4l2loopback' backend: std::exception **Solved:** v4l2loopback was crashed for some reason which caused this issue, Following lines at the beginning of the code fixed the issue. import os if "raspberrypi" in str(os.uname()): os.system("sudo modprobe -r v4l2loopback") os.system("sudo modprobe v4l2loopback")
Dileep (1 rep)
Jun 2, 2021, 05:31 PM • Last activity: Oct 27, 2023, 11:11 AM
1 votes
2 answers
151 views
How can a producer detect if a consumer is attached?
I'm using v4l2loopback plus a program I wrote to produce a virtual camera stream. Right now, I start and stop my program by hand when it's needed. I'd rather have it run as a daemon always, and only produce output when there's a consumer attached to the device. Is there a way for a v4l2loopback prod...
I'm using v4l2loopback plus a program I wrote to produce a virtual camera stream. Right now, I start and stop my program by hand when it's needed. I'd rather have it run as a daemon always, and only produce output when there's a consumer attached to the device. Is there a way for a v4l2loopback producer to detect if a consumer is attached? It looks like poll always returns ready for writing, I don't see an ioctl for this, or changes in the buffer flags or other behavior. Any thoughts?
Piquan (121 rep)
Feb 6, 2021, 11:32 PM • Last activity: Sep 27, 2023, 09:30 AM
0 votes
1 answers
454 views
Internal Data Stream Error Reading v4l2 Virtual Cameras with Gstreamer Pipeline
I'm using v4l2loopback to create 2 virtual cameras that I can then stream an mp4 into and simultaneously read from those cameras with a gstreamer pipeline as if the mp4 was the video being recorded by those virtual cameras. My gstreamer pipeline videomixer name=mix sink_0::xpos=0 sink_0::ypos=0 ! te...
I'm using v4l2loopback to create 2 virtual cameras that I can then stream an mp4 into and simultaneously read from those cameras with a gstreamer pipeline as if the mp4 was the video being recorded by those virtual cameras. My gstreamer pipeline videomixer name=mix sink_0::xpos=0 sink_0::ypos=0 ! tee name=t ! videorate ! videoscale ! videoconvert ! video/x-raw,framerate=3/1,format=RGB,height=240,width=320 ! filesink location=/tmp/realtime_ai_video t. ! x264enc name=h264enc tune=zerolatency ! video/x-h264,stream-format=avc,alignment=au ! queue ! appsink name=mp4_appsink enable-last-sample=true emit-signals=true sync=false drop=false v4l2src device=/dev/video0 do-timestamp=true ! image/jpeg,height=240,width=320,framerate=3/1 ! jpegparse ! jpegdec ! video/x-raw,format=I420 ! mix.sink_0 The command I'm using to create the virtual cameras sudo modprobe v4l2loopback devices=2 card_label="Loopback-1,Loopback-2" The commands I'm using to stream the mp4 into the virtual cameras ffmpeg -re -i r4.mp4 -map 0:v -f v4l2 /dev/video0 ffmpeg -re -i r4.mp4 -map 0:v -f v4l2 /dev/video1 The errors I get from gstreamer when running the pipeline to read from the virtual cameras #033[33m13772#033[00m 0x560d53aeca40 #033[33;01mWARN #033[00m #033[00m basesrc gstbasesrc.c:3127:gst_base_src_loop:#033[00m error: Internal data stream error. #033[33m13772#033[00m 0x560d53aeca40 #033[33;01mWARN #033[00m #033[00m basesrc gstbasesrc.c:3127:gst_base_src_loop:#033[00m error: streaming stopped, reason not-negotiated (-4) ERROR:store.cameras.ringbuffer_camera_writer:gst-stream-error-quark: Internal data stream error. (1) | ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0 - v4l2: v0.12.7 - GStreamer: 1.20.3 - ffmpeg: 4.4.2-0ubuntu0.22.04.1 - OS: Ubuntu 22.04 jammy **The stipulation is that I'd like not to change the pipeline command unless it's a small addition or difference**, I'm wanting to exhaust any other possibility for instance with ffmpeg or v4l2loopback before editing the pipeline.
dan178 (113 rep)
Sep 11, 2023, 07:02 PM • Last activity: Sep 12, 2023, 05:10 AM
1 votes
1 answers
230 views
v4l2loopback-ctl version on debian packages
I would like to use v4l2loopback on a debian (Bookworm) machine. I've installed v4l2loopback-utils package (version 0.12.7-2) but when i run `v4l2loopback-ctl --version` the result is `0.6`. I need to use the `add` command of `v4l2loopback-ctl` but this is not available in the 0.6 version. The probl...
I would like to use v4l2loopback on a debian (Bookworm) machine. I've installed v4l2loopback-utils package (version 0.12.7-2) but when i run v4l2loopback-ctl --version the result is 0.6. I need to use the add command of v4l2loopback-ctl but this is not available in the 0.6 version. The problem seems to be common on every debian versions (Buster, Bullseye ...). Is it normal that the binary is not updated to the last version (0.12.7) ? Thanks, Regards
user574136
May 30, 2023, 01:33 PM • Last activity: May 30, 2023, 03:04 PM
Showing page 1 of 20 total questions