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

Method image_encode_thread

scenedetect/output/image.py:298–322  ·  view source on GitHub ↗
(
        self,
        video: VideoStream,
        encode_queue: queue.Queue,
        save_queue: queue.Queue,
    )

Source from the content-addressed store, hash-verified

296 return image_filenames
297
298 def image_encode_thread(
299 self,
300 video: VideoStream,
301 encode_queue: queue.Queue,
302 save_queue: queue.Queue,
303 ):
304 aspect_ratio = video.aspect_ratio
305 if abs(aspect_ratio - 1.0) < 0.01:
306 aspect_ratio = None
307 # TODO: Validate that encoder_param is within the proper range.
308 # Should be between 0 and 100 (inclusive) for jpg/webp, and 1-9 for png.
309 while True:
310 frame_im, dest_path = encode_queue.get()
311 if frame_im is None:
312 return
313 frame_im = self.resize_image(
314 frame_im,
315 aspect_ratio,
316 )
317 (is_ok, encoded) = cv2.imencode(
318 f".{self._image_extension}", frame_im, self._imwrite_param
319 )
320 if not is_ok:
321 continue
322 save_queue.put((encoded, dest_path))
323
324 def image_save_thread(self, save_queue: queue.Queue, progress_bar: tqdm):
325 while True:

Callers

nothing calls this directly

Calls 1

resize_imageMethod · 0.95

Tested by

no test coverage detected