Skip to content

Incorrect FrameTimecode conversion to string #354

Closed

Description

@Breakthrough

There's a report of a timestamp being converted to string for video splitting with a seconds value of 60, which ffmpeg promptly rejects. This was raised in another project: Breakthrough/DVR-Scan#145

In PR #269 and the associated issue #268, some math was changed to use flooring/truncation instead of rounding to ensure correct conversions when doing round trips from frame numbers to FrameTimecodes. However, there still seems to be some use of rounding for converting the time into a string (e.g. in HH:MM:SS.nnn format).

Notably, rounding is still used by default for this purpose. This math should probably be revisited so the integral and fractional components can be handled correctly:
https://github.com/Breakthrough/PySceneDetect/blob/main/scenedetect/frame_timecode.py#L192

Activity

  1. added this to the v0.6.3 milestone on Oct 9, 2023
  2. Breakthrough commented on Mar 5, 2024

    @Breakthrough
    OwnerAuthor

    Previously it was possible that in some rare cases, rounding might cause an incorrect result that could explain Breakthrough/DVR-Scan#145. I've re-implemented this correctly now, and have added a new test case to ensure this behavior remains consistent.

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

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions