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
linux-v4l2: frame rate list truncates packed value to 32-bit int, so selected frame rate is ignored (driver falls back to max fps) #14036
Selecting a frame rate (e.g. 60.00) in the Video Capture Device (V4L2) properties makes OBS request that frame rate from the device.
Current Behavior
OBS ignores the selected frame rate and requests the device's fastest interval instead. With an Elgato 4K X (UVC, discrete frame intervals of 30/50/59.94/60/120/144 fps), selecting 60.00 produces:
v4l2-input: Pixelformat: NV12
v4l2-input: Framerate: 144.00 fps
The scene collection then contains "framerate": 60.
Side effects: the capture's select() timeout is computed from the bogus frame rate (5 frame periods ≈ 34.7 ms at 144 fps). When the source actually delivers 30 or 60 fps, OBS logs repeated select timed out messages. With MJPG, a timeout or bad frame shortly after start can be followed by failed to unpack jpeg or h264 / Stopped capture after 0 frames. The source then stays frozen on its last frame until it's recreated or OBS is restarted.
Steps to Reproduce
Add a Video Capture Device (V4L2) source for a UVC device that reports discrete frame intervals.
Choose a resolution and select a frame rate below the device maximum (e.g. 60.00).
Check the log: Framerate: shows the device's maximum fps, not the selected value.
Anything else we should know?
In plugins/linux-v4l2/v4l2-input.c, v4l2_framerate_list(), discrete case (line 590 in 32.2.2):
int pack = v4l2_pack_tuple(frmival.discrete.numerator, frmival.discrete.denominator);
v4l2_pack_tuple() returns int64_t (PACK64(a, b) = a << 32 | b). Storing it in an int drops the numerator. For 1/60, PACK64(1, 60) = 4294967356 becomes 60. On load, v4l2_unpack_tuple() sees the upper 32 bits are zero and takes the legacy 16-bit path: numerator = 60 >> 16 = 0, denominator = 60. VIDIOC_S_PARM receives timeperframe = 0/60, and uvcvideo picks the shortest supported interval (144 fps).
The hard-coded list in the non-discrete branch passes *packed (int64_t) directly, so only the discrete branch is affected.
Suggested fix...in theory:
Scene collections already saved with the truncated value (numerator 0) would still request the max rate. It may be worth treating an unpacked numerator of 0 as invalid in v4l2_unpack_tuple() / v4l2_set_framerate(), either by falling back to the device default or by correcting it.
Known workaround:
With OBS closed, set the source's "framerate" in the scene collection JSON to the correctly packed value, e.g. 4294967356 for 1/60. OBS then logs Framerate: 60.00 fps and the timeouts stop. Re-selecting a frame rate in the dropdown writes the truncated value again.
Activity
acscd commentedon Oct 24, 2026
I previously reported this in #13388. Merging PR #13808 (or making a 5-byte change) will fix it. I hope somebody addresses this soon!