Repository navigation
Description
Upstream OBS bug, reported by jrsallee in obsproject/obs-studio#14036 (open, no upstream PR). With an Elgato 4K X (discrete intervals 30/50/59.94/60/120/144 fps), picking 60.00 in a Video Capture Device (V4L2) source logs Framerate: 144.00 fps. The source then floods select timed out, and with MJPG it can stop at Stopped capture after 0 frames and freeze until it is recreated.
The cause in the report (the framerate list stored the packed 64-bit interval through an int) is fixed in this fork since #202 (#201, acscd's obsproject/obs-studio#13808). In 0.1.0-beta.20261014, picking 60.00 requests 1/60 s.
What is still broken is the second half of the report: scene collections saved before that fix still hold the truncated value. That covers everyone coming from stock OBS up to 32.2.2, and obs-rust before #202. In the reporter's words: "Scene collections already saved with the truncated value (numerator 0) would still request the max rate."
Location
plugins/linux-v4l2/v4l2-input.cv4l2_update()line 1391 reads the saved"framerate"as is.v4l2_init()line 1279 passes it tov4l2_set_framerate().plugins/linux-v4l2/v4l2-helpers.hv4l2_unpack_tuple()line 159: a value with the upper 32 bits zero takes the legacy 16-bit path. A truncated60(from 1/60) becomes numerator60 >> 16 = 0, denominator 60.VIDIOC_S_PARMgets 0/60 s per frame, and uvcvideo picks its shortest interval.v4l2_settings_changed()line 1388: the device reports the real packed interval back. The saved60never equals it, so every settings change (a control slider, buffering, anything) restarts the capture. That is the linux-v4l2: Adjusting camera controls (Zoom, Focus, etc.) triggers stream restarts on USB3 4k webcam (Elgato 4k facecam) obsproject/obs-studio#13896 symptom, which linux-v4l2: Keep packed framerate in list values #202 fixed only for newly picked values. Old 16-bit tuples (1 << 16 | 30) request the right rate, but they restart the capture on every change for the same reason.
Class
Wrong device configuration from a saved setting, plus a capture restart on every settings change. No crash.
Reproduced in 0.1.0-beta.20261014
The released AppImage (built from 9e2325e), headless: private Xvfb and D-Bus, fresh HOME, --multi. An LD_PRELOAD stand-in for libv4l2 answers for one camera with the reporter's intervals (30, 50, 59.94 = 1001/60000, 60, 120, 144 fps). Its VIDIOC_S_PARM picks the nearest interval the way uvcvideo does (0/x is the shortest) and logs each request. No real device is opened. The scene collection holds the V4L2 source with the saved "framerate" below. After loading it, one unrelated settings change is made over obs-websocket (Brightness).
Saved "framerate" |
Picked as | Release: S_PARM request, device runs |
Release: restarts on the unrelated change | This branch |
|---|---|---|---|---|
60 (truncated, OBS ≤ 32.2) |
60.00 | 0/60, 144 fps | 1 | 1/60, 60 fps; stored as 4294967356; 0 restarts |
60000 (truncated) |
59.94 | 0/60000, 144 fps | 1 | 1001/60000, 59.94 fps; stored as 4299262323296; 0 restarts |
65566 (1 << 16 | 30, old 16-bit tuple) |
30.00 | 1/30, 30 fps | 1 | 1/30; stored as 4294967326; 0 restarts |
4294967346 (packed 1/50, control) |
50.00 | 1/50, 50 fps | 0 | same |
| picked "60.00" from the list (control, #202) | 60.00 | 1/60, 60 fps | 0 | same |
The release's own list already offers packed values (60.00 = 4294967356). So only saved values are affected, and they stay wrong until the user opens Properties and picks the rate again.
Proposed fix
When the device opens, map a saved value back to the device's interval it was picked from. The lookup uses the discrete intervals of the selected format and size, and v4l2_update() stores the result:
- a truncated value (= the interval's denominator) becomes that interval:
60→ 1/60,60000→ 1001/60000; - an old 16-bit tuple that matches an interval is stored in the 64-bit form the device reports back;
- a value that names no rate (0/x s per frame) and matches no interval becomes "Leave Unchanged", not the driver's fastest rate. So does a denominator that several intervals share (a driver that does not reduce its fractions);
- packed values, "Leave Unchanged", and a source whose device is missing are left as they are.
The reporter suggested this follow-up ("treating an unpacked numerator of 0 as invalid ... either by falling back to the device default or by correcting it"). This corrects it where the device lists the interval, and falls back to the device's rate otherwise.
RED test: test_v4l2_framerate also runs the real v4l2-input.c against a fake libv4l2 with the reporter's intervals. 6 of 11 cases fail today:
- truncated 1/60 and 1001/60000 run the camera at 144 fps (2 end-to-end cases, 1 unit case);
- an unmatched truncated value is sent as 0/25 s per frame (1 end-to-end, 1 unit);
- an old 16-bit tuple is not stored in the device's form (1 unit).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 16, 2026
Claiming: this issue.
This is the part of upstream #14036 that our #202 (#201) left open. #202 fixed what the frame rate list stores. Scene collections saved before it still hold the truncated value.
test_v4l2_frameratealso runs the realv4l2-input.cagainst a fake libv4l2 with the reporter's intervals (30/50/59.94/60/120/144 fps, uvcvideo-styleS_PARM). A source saved with60or60000must run at 1/60 or 1001/60000 and store that interval, with no restart on an unrelated change. An unmatched truncated value must not be sent as 0/x, and an old 16-bit tuple must be stored in the device's form. Today 6 of 11 cases fail.linux-v4l2: Map framerates saved truncated to the device's interval (o…
rdoupe commentedon Oct 16, 2026
@jrsallee you reported this in obsproject/obs-studio#14036: picking 60.00 for a V4L2 Video Capture Device ran the Elgato 4K X at 144 fps. Heads-up that both halves are fixed here in obs-rust. Frame rates picked from the list are stored correctly since #202 (acscd's upstream fix, obsproject/obs-studio#13808). #1118, merged today with a regression test, handles the scene collections that were already saved with the truncated value, as you suggested in the report.
Cause: the saved
"framerate": 60is what's left of 1/60 after the truncation. It unpacks as 0/60 s per frame, so uvcvideo picks its shortest interval. It also never matches the interval the device reports back, so every settings change restarted the capture. Now, when the camera opens, a saved value is mapped back to the device's interval it came from:60→ 1/60,60000→ 1001/60000 (59.94). The result is written to the scene collection. A value that matches nothing and names no rate becomes "Leave Unchanged" instead of the fastest rate. In our release, a source saved with60ran at 144 fps and restarted on an unrelated change. With the fix it runs at 60 fps, stores4294967356(your workaround value), and does not restart. We used a stand-in for your camera's frame intervals, not real hardware.Workaround on stock OBS: yours (set the packed value, e.g.
4294967356for 1/60, in the scene collection with OBS closed).It will be in the next obs-rust daily release after 0.1.0-beta.20261014: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's
obs-studio-rust-gitin the AUR). obs-rust is an AI-assisted fork of OBS.If you get a chance to try it with your existing scene collection, a reply here on whether the log now says
Framerate: 60.00 fpswould really help.jrsallee commentedon Oct 17, 2026
zackees commentedon Oct 17, 2026
Thanks @jrsallee. You're right, the daily release has been held since 0.1.0-beta.20261014: the Windows packaging check is blocking it (#1225). The fix will be in the first daily after that clears; no need to check before then.
jrsallee commentedon Oct 18, 2026
Tested obs-rust 0.1.0-beta.20261018 (Linux AppImage, Fedora/Bazzite, kernel 7.2.9) with a fresh config and a copy of my scene collection with the truncated values put back: Elgato 4K X "framerate": 60 (NV12 2560x1440) and Logitech BRIO "framerate": 30 (MJPG 3840x2160).
All three behaviors confirmed. Thanks for the fix!
rdoupe commentedon Oct 18, 2026
Thank you for testing this so thoroughly. Checking
v4l2-ctl --get-parmand the saved values against the real cameras is exactly the confirmation we needed. Glad the 4K X runs at 60 now.