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

Function compute_downscale_factor

scenedetect/scene_manager.py:123–140  ·  view source on GitHub ↗

Get the optimal default downscale factor based on a video's resolution (currently only the width in pixels is considered). The resulting effective width of the video will be between frame_width and 1.5 * frame_width pixels (e.g. if frame_width is 200, the range of effective widths will

(frame_width: int, effective_width: int = DEFAULT_MIN_WIDTH)

Source from the content-addressed store, hash-verified

121
122
123def compute_downscale_factor(frame_width: int, effective_width: int = DEFAULT_MIN_WIDTH) -> float:
124 """Get the optimal default downscale factor based on a video's resolution (currently only
125 the width in pixels is considered).
126
127 The resulting effective width of the video will be between frame_width and 1.5 * frame_width
128 pixels (e.g. if frame_width is 200, the range of effective widths will be between 200 and 300).
129
130 Arguments:
131 frame_width: Actual width of the video frame in pixels.
132 effective_width: Desired minimum width in pixels.
133
134 Returns:
135 int: The default downscale factor to use to achieve at least the target effective_width.
136 """
137 assert frame_width > 0 and effective_width > 0
138 if frame_width < effective_width:
139 return 1
140 return frame_width / float(effective_width)
141
142
143def get_scenes_from_cuts(

Callers 1

detect_scenesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected