Skip to content

v4l2 input sets incorrect framerate #13388

Open

Description

@acscd

Operating System Info

Other

Other OS

Manjaro Linux

OBS Studio Version

Other

OBS Studio Version (Other)

OBS 32.1.0, 32.1.2 (distro packages), also present in Flatpak; v4l2 plugin distro packaged or latest from git (optionally w/ patch below)

OBS Studio Log URL

https://obsproject.com/logs/d9PdKsvIEWLOYDTt

OBS Studio Crash Log URL

No response

Expected Behavior

When setting the framerate in Source Properties, the device would be set to the framerate selected. (30 in my case)

Current Behavior

The device in my case ends up set to 60fps.
It attempts to set the device to inf (selected FPS / 0) which results in v4l2 picking the best it can (60 in my case).

Steps to Reproduce

  1. (optional) In v4l2-input.c, at line 944 add the following:v4l2_unpack_tuple(&fps_num, &fps_denom, data->framerate); blog(LOG_DEBUG, "Attempting to set framerate: %.2f fps, (%d / %d)", (float)fps_denom / fps_num, fps_denom, fps_num); v4l2-input_better_debug.patch
  2. (assuming a v4l2 source is already set up, if not add one)
  3. change the framerate in the source properties
  4. observe that the chosen framerate has not been applied correctly
  5. (in my case) get mad because input device stops working
    ...

Anything else we should know?

Best I can tell, the packed framerate is being truncated to 32 bits somewhere in OBS's properties storage, which results in an FPS denominator of 0. If I edit the relevant line in ~/.config/obs-studio/basic/scenes/[scene name].json to have the correct 64bit packed value (4294967326 for 30FPS), the device is initially set correctly (until Properties is opened). (Why does simply opening the Properties even set anything??? see #3092) If setting is changed and saved, the JSON will contain only the numerator (30), rather than the correct packed value.

This is a significant problem for some (probably cheap) video devices like mine which do not actually work at 60FPS at full resolution.

v4l2-input_better_debug.patch

Activity

  1. acscd commented on May 2, 2026

    @acscd
    Author

    Possibly v4l2_set_framerate (v4l2-helpers.c) should sanity check for a FPS numerator or denominator of 0. Could even put a workaround there, but that wouldn't really solve the problem.

  2. acscd commented on May 4, 2026

    @acscd
    Author

    I just got 32.1.2 from Arch/Manjaro; it also has this issue.

  3. acscd commented on Aug 20, 2026

    @acscd
    Author

    Confirmed still present in latest versions, however I found the bug: the int on line 590 of v4l2-input.cshould be a uint64_t.
    PR opened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions