Skip to content

sequence.py: per-frame concat durations rounded to the microsecond drift by half a frame after about 28 minutes #474

Open

Description

@kajisho5

What happens. sequence.py writes a concat list with duration {1/fps:.6f} for every frame. At 30 fps, 1/30 s is written as 0.033333, which is 3.3e-7 s short of a frame. The concat demuxer adds up the durations as written, so every frame starts a little early, by an amount that grows with each frame.

The drift reaches half a frame after about 50,000 frames (about 28 minutes at 30 fps). From there a frame can be dropped or repeated. Rates whose frame time is not a whole number of microseconds drift the same way, for example 29.97 and 23.976.

Proposed fix. Compute each frame's start from its frame index at the exact rate, and write that frame's time as the difference between neighbouring exact starts, each rounded once. The same repo now does this for join.py's sample counts. Alternatively, write one duration per run of frames with an exact total.

Found by. The sibling sweep for #455 / #468 (#473).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions