PySceneDetect icon indicating copy to clipboard operation
PySceneDetect copied to clipboard

Incorrect FrameTimecode conversion to string

Open Breakthrough opened this issue 2 years ago • 0 comments

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

Breakthrough avatar Oct 09 '23 20:10 Breakthrough