HolyWu / vs-rife

RIFE function for VapourSynth
MIT License
103 stars 8 forks source link

Wrong output framerate #22

Closed chainikdn closed 1 year ago

chainikdn commented 1 year ago

That - https://github.com/HolyWu/vs-rife/blob/91e894f41cbdfb458ef8f776c47c7f652158bc6f/vsrife/__init__.py#L280 - doesn't work as expected because of two reasons:

  1. clip.fps.numerator / denominator can be 0 / 1 (from the docs: "It is 0/1 when the clip has a variable framerate")
  2. there's a frame duration attached to each frame, and it seems like FrameEval(frame_adjuster) return frames with the original durations, not the ones from format_clip

A quick fix that works:

    clip0 = vs.core.std.Interleave([clip] * factor_num)
    if factor_den>1:
        clip0 = clip0.std.SelectEvery(cycle=factor_den,offsets=0)
    clip1 = clip.std.DuplicateFrames(frames=clip.num_frames - 1).std.DeleteFrames(frames=0)
    clip1 = vs.core.std.Interleave([clip1] * factor_num)
    if factor_den>1:
        clip1 = clip1.std.SelectEvery(cycle=factor_den,offsets=0)
HolyWu commented 1 year ago

Thanks. I totally forgot to check frame duration.