Skip to content

Deinterlacing "Bottom Frame First" footage in Double Framerate yields incorrect output #6061

Open

Description

@ray890

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

27.2.1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/XatW6D21UZ_tunCz

OBS Studio Crash Log URL

No response

Expected Behavior

Sets of fields should be reconstructed in their appropriate frames, constructing the first set of fields in every odd frame, and the second set of fields in every even frame. This results in smooth video output with every frame in order, represented by the pattern of 1, 2, 3, 4, 5, 6, [...].

This would match the existing working OBS behavior when "Top Fields First" footage is deinterlaced in "Top Fields First" mode.

image

original_timecode.mp4

Current Behavior

In the video output, top fields are delayed by 6 frames while bottom frames are constructed properly, resulting in a jerky video
constructed out of order in the pattern of 1, 6, 3, 8, 5, 10, [...]

image

Incorrect.Output.mp4

Steps to Reproduce

  1. Add an input source that contains video content that is interlaced using the "Bottom Field First" method
  2. Enable the Deinterlacing using Blend 2x, Linear 2x or Yadif 2x
  3. Set the Deinterlacing mode to "Bottom Field First"
  4. Watch the video output

Anything else we should know?

If a "Top Fields First" video were to be properly deinterlaced with "Bottom Fields First", and vice versa, then the second set of fields should be constructed one frame behind, leading to a mildly jerky video output. This is expected behavior, and not the behavior currently achieved with this bug.

image

Bottom.Fields.First.deinterlaced.as.Top.Fields.First.mp4
Top.Fields.First.deinterlaced.as.Bottom.Fields.First.mp4

Activity

  1. faradey8951 commented on Dec 17, 2022

    @faradey8951

    Agree! It really annoys me as well. I can't double the output framerate in OBS and it cause wrong output frame order

  2. rob-fi commented on Dec 3, 2024

    @rob-fi

    Chiming in to say this is still an issue. Running OBS 30.2.3 and attempting to use Yadif 2x deinterlacing for bottom-field first video (for example DV content). As detailed above and confirmed in my video below, this results in a big mess.

    The Linear 2x does work but it doesn't look nearly as good as Yadif 2x.

    obs-yadif-bottom2.mp4
  3. rob-fi commented on Dec 10, 2024

    @rob-fi

    I have since done some playing around.

    In C:\Program Files\obs-studio\data\libobs\deinterlace_base.effect I modified the following line (58) to say field 1 rather than 0:

    float4 load_at(int2 texel, int x, int y, int field)
    {
    	if(field == 1)
    		return load_at_image(texel, x, y);
    	else
    		return load_at_prev(texel, x, y);
    }
    

    It works! For BFF video that is. Of course, TFF deinterlacing was now broken. However, I did this following hack:

    float4 load_at(int2 texel, int x, int y, int field)
    {
    
    	if(field != field_order)
    		return load_at_image(texel, x, y);
    	else
    		return load_at_prev(texel, x, y);
    }
    

    And now it seems to work correctly for both TFF and BFF. I have absolutely no idea what the implications are of making this change, and I'll make the assumption that this is not the correct way to fix it until someone with more knowedge on the matter can chime in. But it's a workaround.

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