Repository navigation
Description
Upstream OBS bug, reported by zoton2 in obsproject/obs-studio#3402 (Windows 10, OBS 25.0.8, retested on 28.1.2). A PAL console (50i) through a capture card, deinterlaced with Yadif 2x, looks choppy when the OBS canvas runs at 60 fps and smooth when it runs at 50 fps. They expected it to behave like a 50p source on a 60 fps canvas: "5 unique frames followed by 1 duplicate". mufunyo agreed it is a bug ("The current implementation only works if the source frame rate exactly matches the canvas frame rate") and suggested flipping the field "on the canvas update closest to the second half of its present time". crannofonix runs a news channel that mixes 50i and 60p feeds, where the 50i feed looks like "40 or 48" fps. OBS team members (PatTheMav, Fenrirthviti) called it intended behaviour and closed it as stale in 2024 ("If there is an actual bug here, PRs are welcome"). The code has not changed upstream or in this fork.
Location
libobs/obs-source-deinterlace.c:
- Lines 396-398: the second field of a frame is shown once
video_time >= frame_ts + deinterlace_offset + half_duration - 1 ms. - Lines 188-196,
deinterlace_get_closest_frames(): the offset isvideo_time - frame_tsat the canvas tick that picked the frame, which lags the frame by anything up to a canvas interval. Buffered sources re-anchor it when the lag moves by more than half an interval (line 194). - Line 52,
ready_deinterlace_frames(): unbuffered sources reset the offset on every frame, so it is re-anchored at every pick.
With 50i on a 60 fps canvas the lag moves on every frame:
- Buffered sources keep re-anchoring, and the second field often comes due only after the next frame has replaced it.
- Unbuffered sources hold each frame for its duration rounded up to whole ticks (50 ms instead of 40 ms). They fall behind and drop whole frames.
Unbuffered matters here: DirectShow's default "Auto" buffering turns buffering on only for delayed devices (plugins/win-dshow/win-dshow.cpp line 868), so most capture cards on Windows run unbuffered.
Class
Dropped video fields: motion stutters on any interlaced source whose field rate is not the canvas rate (50i on a 60 fps canvas, 60i on 50 fps, 50i on 30 fps). Matched rates are fine. Decoding and encoding are not involved.
How it is reached
Set the canvas to 60 fps, add an interlaced 50i source (capture card, or a Media Source playing an interlaced file) and set Deinterlacing to Yadif 2x, Linear 2x or Discard 2x. Step through a recording frame by frame: fields are skipped (1 3 4 5 7 8 9 11 ...).
Reproduced headlessly with a libobs test: an async source pushes 36 interlaced frames whose fields carry their capture index, and every output frame is classified by the field it kept.
- Buffered, 50i into 60 fps: each double-rate mode and field order shows 50-51 of the 72 fields and skips 19-20.
- Unbuffered, 50i into 60 fps: 10-12 fields skipped, a whole frame at a time.
- Unbuffered, 50i into 30 fps and 60i into 50 fps: two fields skipped in a row, where at most one should be.
- Matched rates (60i into 60, 50i into 50) show every field.
Upstream work
None. No upstream PR for this. The open obsproject/obs-studio#12431 reworks async timestamps but leaves deinterlaced sources for later. Related, not the same: obsproject/obs-studio#7464 (a capture card scaled before deinterlacing).
Proposed fix and failing test
Fix (libobs only, obs-source-deinterlace.c):
- Buffered sources: take the offset from the source clock that picks the frames (
last_frame_ts), plus the 2 ms the frame picker already waits. The second field then comes due by the same rule that brings the next frame, half a frame earlier. - Unbuffered sources: keep the offset. Re-anchor it only when a frame comes earlier than it, or so late that it missed its tick and its first field.
- Shaders, decoding and encoding are unchanged.
RED test: extend test_deinterlace_2x_field_order (from the Yadif 2x field order fix) with rate pairs. It runs on Linux under xvfb, loads the built GL module, and skips without a display.
- Yadif 2x, Linear 2x and Discard 2x, both field orders, at 60i into 60, 50i into 50, 50i into 60, 50i into 30 and 60i into 50 fps; Yadif 2x also unbuffered at the same pairs (40 cases).
- No field may go back in time.
- When the canvas is at least as fast as the field rate, no field may be skipped, and buffered sources may hold a field for at most canvas / field rate frames, rounded up.
- When the canvas is slower, at most one field may be dropped between two shown ones.
12 of 40 fail today: the 6 buffered cases at 50i into 60 fps, and the 6 unbuffered cases with mismatched rates.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 12, 2026
Claiming: this issue.
test_deinterlace_2x_field_orderextended to 40 cases (12 failing): fields tagged with capture order through Yadif, Linear and Discard 2x, both field orders, buffered and unbuffered, at 60i/50i into 60/50/30 fps canvases; no field may be skipped when the canvas is faster, at most one in a row when it is slower, and none may go back in time.PR today.
libobs: Show every field with 2x deinterlacing at another canvas rate
rdoupe commentedon Oct 12, 2026
@zoton2 you reported this in obsproject/obs-studio#3402, so a heads-up: it's fixed here in obs-rust by #395, merged today with a regression test.
Cause: with Yadif, Linear or Discard 2x, the second field of each frame is due half a frame after the first, but OBS timed it from the canvas tick that happened to pick the frame, which lags the frame by up to one canvas interval. When the field rate and the canvas rate differ (your 50i into a 60 fps canvas), that lag changes every frame, so the second field often came due after the next frame had already replaced it and was never shown. Unbuffered sources (most capture cards run unbuffered) had it worse: the timing reset on every frame, frames were held too long, and whole frames were dropped. mufunyo and crannofonix described the same thing in your thread. Now the second field is timed from the frame's own timestamp, and unbuffered sources keep their timing unless a frame really arrives early or late. The test feeds fields tagged with their capture order through all three 2x modes, both field orders, buffered and unbuffered, at 50i and 60i into 30, 50 and 60 fps canvases: before, 50i into 60 showed about 50 of 72 fields; now no field is skipped when the canvas is faster, and at most one in a row when it's slower.
Not covered: tested with a synthetic interlaced source, not a real 50i capture card; the Blend 2x mode isn't affected by this change.
Workaround on stock OBS: run the canvas at the source's field rate (50 fps for 50i), or deinterlace outside OBS.
obs-rust is an AI-assisted fork of OBS; on Arch it's
obs-studio-rust-gitin the AUR.If you try it, a short reply here on whether 50i into 60 looks smooth for you would really help.
libobs: Show every field with 2x deinterlacing at another canvas rate (…