Skip to content

Request: option to replace duplicate frames with interpolated ones instead of dropping them #207

@awebeer256

Description

@awebeer256

Usually, duplicate frames in the input video do not represent an actual ceasing of motion in the canonical events that the video is portraying. Instead, they are typically an artifact of either the video having been reformatted from 24 or 25fps to 30, or an animation style that duplicates frames to cut costs. In both of these cases, an interpolated video will be smoother if the interpolation software recognizes these duplicate frames as placeholders. For example, suppose your input video has the following frames: A, B, C, C, D, etc.

If I understand correctly, the current default behaviour (doubling the framerate) will cause the following output:

In  Out
--------
A   A
    A-B
B   B
    B-C
C   C
    C
C   C
    C-D
D   D
etc.

And using the --skip flag will produce this instead:

In  Out
-------------
A   A
    A-B
B   B
    B-C
C   C
    C-D
C   D
etc.

That is, with --skip, duplicate frames are effectively cut from the input video—which shortens the video—before interpolation. This strikes me as...let's call it "extremely counter-intuitive"...from a user experience standpoint. I'm guessing that this flag was meant to only be used in tech demos, but the fact that it's the only even remotely intelligent way of handling duplicate frames gives the opposite impression. The intuitive behaviour would be to keep the duration the same but interpolate through the pair of duplicate frames, so the output would look like this:

In  Out
-------------
A   A
    A-B
B   B
    B-C
C   C
    C-(C-D)
C   C-D
    (C-D)-D
D   D
etc.

In other words, instead of the duplicate frame being cut, it is replaced with an interpolated frame, which is then interpolated with its neighbours as normal.

What I'm proposing is changing the default behaviour such that whenever a sequence of duplicate frames in the input video, with a length of exactly 2, is found, the second one is replaced with an interpolated frame before the main, framerate-increasing interpolation is done. This would cover the two main use cases that I mentioned up top. False-positives would be both rare and minimally harmful, but a user could disable the feature through command-line options. Perhaps an option called --dupes, with the possible values of keep (the current default), absorb (the new default that I'm proposing), and skip (equivalent to the --skip flag, which would in turn be deprecated).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions