MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / timecode

Method timecode

scenedetect/backends/opencv.py:212–219  ·  view source on GitHub ↗

Current position within stream as a Timecode.

(self)

Source from the content-addressed store, hash-verified

210
211 @property
212 def timecode(self) -> Timecode:
213 """Current position within stream as a Timecode."""
214 # *NOTE*: Although OpenCV has `CAP_PROP_PTS`, it doesn't seem to be reliable. For now, we
215 # use `CAP_PROP_POS_MSEC` instead, converting to microseconds for sufficient precision to
216 # avoid frame-boundary rounding errors at common framerates like 24000/1001.
217 ms = self._cap.get(cv2.CAP_PROP_POS_MSEC)
218 time_base = Fraction(1, 1000000)
219 return Timecode(pts=round(ms * 1000), time_base=time_base)
220
221 @property
222 def position(self) -> FrameTimecode:

Callers

nothing calls this directly

Calls 1

TimecodeClass · 0.90

Tested by

no test coverage detected