Skip to content

bug: libobs: Yadif 2x shows bottom-field-first video out of order (upstream #6061) #316

Closed

Description

@rdoupe

Upstream OBS bug, reported by ray890 in obsproject/obs-studio#6061 (also faradey8951 and rob-fi, who found a shader workaround). Code unchanged in this fork.

Location

  • libobs/data/deinterlace_base.effect load_at(): the frame is picked by row parity only (even rows from the current frame, odd rows from the previous one), and texel_at_yadif_2x() keeps rows of parity field_order on the first pass and the other parity on the second. field_order is 1 for top field first and 0 for bottom field first (libobs/obs-source-deinterlace.c).
  • For top field first that shows the previous frame's bottom field, then the current frame's top field (in order). For bottom field first it shows the current frame's top field, then the previous frame's bottom field, so every other output frame goes back three fields in time.

Class

Wrong output: Yadif 2x deinterlacing of bottom-field-first video judders back and forth.

How it is reached

A source with interlaced bottom-field-first video (DV, many capture devices), Deinterlacing → Yadif 2x, Field Order → Bottom Field First. Motion stutters back and forth; Top Field First, Linear 2x and Discard 2x are fine.

Reproduced headlessly: an async source outputs interlaced frames with each field marked by its capture index, and the program output's fields are classified per frame. Yadif 2x BFF shows 1 3 0 5 2 7 4 9 6 ... (35 steps back in 71 fields); all other modes and orders show fields in order.

Proposed fix and failing test

Fix (the form of rob-fi's workaround): the first field of a frame comes from the current frame and the second from the previous one, so the kept field always sits between the two frames it is interpolated from. Top field first output is mathematically unchanged.

RED test (cmocka, test_deinterlace_2x_field_order): Yadif 2x, Linear 2x and Discard 2x, each top and bottom field first. Only Yadif 2x BFF fails today.

Activity

  1. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_deinterlace_2x_field_order (1 of 6 failing): fields tagged with their capture index through Yadif/Linear/Discard 2x, both field orders, checked on program output.
    2. GREEN: take the first field from the current frame and the second from the previous one (rob-fi's workaround), so top field first is unchanged.
      PR today.
  2. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    @ray890 you reported this in obsproject/obs-studio#6061, so a heads-up: it's fixed here in obs-rust by #317, merged today with a regression test.

    Cause: the Yadif shader chose which frame each field comes from by row parity alone, which happens to be right for top field first; for bottom field first it showed the current frame's top field before the previous frame's bottom field, so every other output frame went back in time. The fix takes the first field of a frame from the current frame and the second from the previous one, which is the condition rob-fi found in your thread; top field first output is unchanged. The test feeds fields tagged with their capture order through Yadif, Linear and Discard 2x in both field orders: before, Yadif 2x BFF went 1 3 0 5 2 7 4 ...; now every mode shows the fields in order.

    Not covered: Blend 2x, which you also mention, ignores the field order in its shader and may need its own fix.

    Workaround on stock OBS: use Linear 2x or Discard 2x for bottom-field-first sources.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you try it, a short reply here on whether your BFF footage plays smoothly would really help.

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions