Skip to content

Commit fbf6e0e

Browse files
committed
[timecode] Add new Timecode and Framerate types
The existing FrameTimecode type assumes fixed framerate, and relies on it for calculation of durations. This splits both out, and adds timing information in addition to frame number. This will need to be integrated in the VideoStream side of things first, before starting to work through SceneManager and the Detector interface.
1 parent 3dfeb9a commit fbf6e0e

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

scenedetect/timecode.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# PySceneDetect: Python-Based Video Scene Detector
3+
# -------------------------------------------------------------------
4+
# [ Site: https://scenedetect.com ]
5+
# [ Docs: https://scenedetect.com/docs/ ]
6+
# [ Github: https://github.com/Breakthrough/PySceneDetect/ ]
7+
#
8+
# Copyright (C) 2014-2025 Brandon Castellano <http://www.bcastell.com>.
9+
# PySceneDetect is licensed under the BSD 3-Clause License; see the
10+
# included LICENSE file, or visit one of the above pages for details.
11+
#
12+
13+
from dataclasses import dataclass
14+
15+
16+
@dataclass
17+
class Framerate:
18+
"""Describes how time passes between frames in the video."""
19+
20+
rate: float
21+
"""Framerate in frames per second."""
22+
fixed: bool
23+
"""True for constant frame rate (CFR), false for variable frame rate (VFR)."""
24+
25+
26+
@dataclass
27+
class Timecode:
28+
"""Timing information associated with a given frame."""
29+
30+
time: float
31+
"""Presentation time in seconds."""
32+
duration: float
33+
"""Presentation duration in seconds."""
34+
frame: int
35+
"""Frame number."""

0 commit comments

Comments
 (0)