How to split a .mov file into images

Tutorial

You can split a .mov  file into a series of images with the supervision Python package.

supervision  has a set of utilties that lets you retrieve frames from a video and save those frames to a folder in a few lines of code. This functionality is powered by OpenCV.

First, install supervision:

Then, use the following code to split the file into images:


import supervision as sv

frames_generator = sv.get_video_frames_generator("video.mov", stride=1)

with sv.ImageSink(target_dir_path="output") as sink:
    for image in frames_generator:
        sink.save_image(image=image)

Next Steps

OpenCV can be used with the open source supervision Python package.

supervision provides an extensive range of functionalities for working with computer vision models. With supervision, you can:

1. Process and filter detections and segmentation masks from a range of popular models (YOLOv5, Ultralytics YOLOv8, MMDetection, and more).
2. Process and filter classifications.
3. Compute confusion matrices.

And more! To learn about the full range of functionality in supervision, check out the supervision documentation.