Repository navigation
Description
Operating System Info
Ubuntu 26.04
Other OS
No response
OBS Studio Version
32.2.2
OBS Studio Version (Other)
No response
OBS Studio Log URL
OBS Studio Crash Log URL
No response
Expected Behavior
Stopping and starting the Virtual Camera again works while a recording is in progress.
Current Behavior
Restarting the Virtual Camera fails with "Starting the output failed. Please check the log for details."
The log only shows:
Starting Virtual Camera output to Source : <source>
Failed to start virtual camera
The Virtual Camera can be started again as soon as the recording is stopped.
Steps to Reproduce
- Start Virtual Camera
- Start Recording
- Stop Virtual Camera
- Start Virtual Camera: fails
- Stop Recording, then Start Virtual Camera: works
Anything else we should know?
Disclaimer: I used an LLM to search for similar issues and help fill in this section. Figured it's better than just leaving it mostly empty.
obs-ffmpeg-mux inherits the V4L2 file descriptors that OBS has open, and it keeps them open for the whole recording. After step 3, with no other consumer of the loopback device:
$ fuser -v /dev/video4
USER PID ACCESS COMMAND
/dev/video4: avasam 35094 F.... obs-ffmpeg-mux
With exclusive_caps=1, v4l2loopback still sees an open handle from the old producer, so OBS can't reopen the device as an output. The same muxer process was also holding /dev/video0 and /dev/video2, the V4L2 Video Capture Device sources in my scenes. This probably explains the comment in #12506 about not being able to close and reopen a webcam while recording.
Cause: V4L2 devices are opened without O_CLOEXEC, and os_process_pipe_create uses posix_spawn, which only marks its own pipes close-on-exec (#10574). Any other descriptor leaks into the child.
obs-studio/plugins/linux-v4l2/v4l2-output.c
Line 158 in f1c0a11
vcam->device = open(device, O_RDWR); open(device, O_RDWR)obs-studio/plugins/linux-v4l2/v4l2-input.c
Line 373 in f1c0a11
if ((fd = v4l2_open(device.array, O_RDWR | O_NONBLOCK)) == -1) { obs-studio/plugins/linux-v4l2/v4l2-input.c
Line 892 in f1c0a11
data->dev = v4l2_open(data->device_id, O_RDWR | O_NONBLOCK);
Suggested fix: add O_CLOEXEC to these open / v4l2_open calls. Closing all non-stdio fds in the child after spawning would be a broader option.
Not the same root cause as #12506 (fixed by #12510), even though the symptom is the same.
Environment:
- OBS 32.2.2, Flatpak, X11
- v4l2loopback 0.15.3 (DKMS) with the options OBS uses by default (
exclusive_caps=1) - kernel 7.0.0-38-generic
- Not tested without
exclusive_caps=1
Activity
[-]Linux: `obs-ffmpeg-mux` inherits V4L2 device file descriptors , so Virtual Camera can't restart while recording[/-][+]Linux: `obs-ffmpeg-mux` inherits V4L2 device file descriptors, so Virtual Camera can't restart while recording[/+]tiberium-v commentedon Oct 19, 2026
I can't reproduce that - but I'm on Arch linux and kernel 6.18 LTS.