You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: linux-v4l2: Virtual Camera can't restart during a recording because the muxer inherits its device fd (upstream #14054) #2278
Upstream OBS bug, reported in obsproject/obs-studio#14054 (Linux): Virtual Camera can't be restarted while a recording is running.
Cause (master)
plugins/linux-v4l2/v4l2-output.c.h: try_connect() (around line 147, open(device, O_RDWR)) and the probe loop in loopback_module_available() (around line 107) open the v4l2loopback device without O_CLOEXEC.
os_process_pipe_create() (C posix_spawn, and the Rust Command in rust/obs-util/src/platform/unix/pipe.rs) closes only its own pipe fds.
So obs-ffmpeg-mux, started for the recording, inherits the device fd and keeps it open for the whole recording.
With exclusive_caps=1, v4l2loopback then refuses a new producer when the virtual camera is stopped and started again.
The comment at pipe.rs:35 saying non-stdio fds are closed in the child is wrong. Command keeps any inherited fd that lacks FD_CLOEXEC.
plugins/obs-ffmpeg/vaapi-utils.c.h:24 leaks a render-node fd the same way. #340 fixed only the V4L2 input side.
Plan
RED:
Open the loopback output through the virtual camera output, using vivid's output node. Assert that FD_CLOEXEC is set on its fd.
End to end: while the virtual camera is active, spawn a child with os_process_pipe_create() and assert the device is not in /proc/<child>/fd.
The same check for the VAAPI probe fd.
GREEN: open with O_CLOEXEC in both v4l2-output paths and in vaapi-utils, and correct the pipe.rs comment.
@Avasam The Linux Virtual Camera could not be restarted while a recording was running (upstream obs-studio issue 14054). The cause was that the recording's muxer process inherited the virtual camera's device handle and held it open for the whole recording, so the device refused a new producer. In obs-rust the handle is now kept out of child processes, so stopping and starting the Virtual Camera during a recording works.
obs-rust is an AI-assisted fork of OBS, based on current OBS master, with extra bug fixes like this one.
Activity
rdoupe commentedon Oct 25, 2026
Claiming: #2278.
test: Virtual Camera device leaks into children
linux-v4l2: Open the Virtual Camera close-on-exec
test: Virtual Camera device leaks into children
linux-v4l2: Open the Virtual Camera close-on-exec
linux-v4l2: Keep the virtual camera fd out of child processes (obs-ru…
rdoupe commentedon Nov 1, 2026
@Avasam The Linux Virtual Camera could not be restarted while a recording was running (upstream obs-studio issue 14054). The cause was that the recording's muxer process inherited the virtual camera's device handle and held it open for the whole recording, so the device refused a new producer. In obs-rust the handle is now kept out of child processes, so stopping and starting the Virtual Camera during a recording works.
obs-rust is an AI-assisted fork of OBS, based on current OBS master, with extra bug fixes like this one.
It ships in the OBS-Studio-Rust v1.0.0 release: https://github.com/obs-rust/obs-studio/releases