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

Method frame_num

scenedetect/common.py:263–274  ·  view source on GitHub ↗

The frame number. For VFR video or Timecode-backed objects, this is an approximation based on the average framerate. Prefer using `pts` and `time_base` for precise timing.

(self)

Source from the content-addressed store, hash-verified

261
262 @property
263 def frame_num(self) -> int:
264 """The frame number. For VFR video or Timecode-backed objects, this is an approximation
265 based on the average framerate. Prefer using `pts` and `time_base` for precise timing."""
266 if isinstance(self._time, Timecode):
267 # Calculate approximate frame number from seconds and framerate.
268 if self._rate is not None:
269 return round(self._time.seconds * float(self._rate))
270 # No framerate available - return estimate based on time.
271 return round(self._time.seconds)
272 if isinstance(self._time, _Seconds):
273 return self._seconds_to_frames(self._time.value)
274 return self._time.value
275
276 @property
277 def frame_rate(self) -> Fraction | None:

Callers

nothing calls this directly

Calls 1

_seconds_to_framesMethod · 0.95

Tested by

no test coverage detected