obsproject / obsproject/obs-studio

V4L2 input does not close while recording

Open
#12,508 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
76.4k
Forks
10.2k
Avg merge
4d 23h
Merged PRs (30d)
12

Description

Operating System Info

Ubuntu 24.04

Other OS

No response

OBS Studio Version

Git

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/Ombuu5dUBteEJ6AN

OBS Studio Crash Log URL

No response

Expected Behavior

Should be able to start and stop V4L2 input while recording, e.g. when changing resolution of the camera.

Current Behavior

Freezes after the resolution is changed.

Steps to Reproduce
  1. Add a "Video Capture Device (V4L2)" to the scene, select a webcam.
  2. Activate Start recording.
  3. Open properties of the "Video Capture Device (V4L2)" source, and make any change that requires camera restart (e.g. frame rate, resolution, etc).

The device freezes.

The device appears to be closed once Stop recording is activated and can then be re-activated.

When not recording, the device stops and starts without problem.

Anything else we should know?

This goes as far back as 30.2.3 at least; haven't tested further back as it gets more difficult to build. Maybe this is a dependency issue or perhaps something in certain kernels - it seems odd that the file (descriptor) isn't cleaned up properly by the call to v4l2_close().

Would like to confirm if others have experienced the same issue.

Currently running 6.14.0-27 generic on Ubuntu 24.04 (HWE kernel line).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the V4L2 camera restart during recording on Ubuntu 24.04 with the reported kernel, then inspect the linked OBS log and the V4L2 input lifecycle. Trace what happens when resolution or frame rate changes and compare it with the same change while not recording. Done means the device can be changed without freezing and can be stopped and restarted during recording.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux, ubuntu
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.