framezip is a lightweight and pure-Python toolkit to compress image sequences into a video and decompress them later, with quality evaluation using PSNR and SSIM metrics. All this without external dependencies like FFmpeg.
One day, we asked ourselves a simple yet intriguing question:
"Is a video made of N frames heavier than N individual images? Or the opposite?"
That curiosity kicked off a spontaneous experiment — and framezip was born.
We built this toolkit to answer that question and explore:
- How much compression we get from turning images into videos
- How much quality we lose in the process (if any)
- How to automate the whole test: compress → decompress → evaluate
Whether you're a curious dev, researcher, or compression nerd, framezip is here to help you explore this kind of visual comparison easily.
- Renames images using the pattern
frame001.jpg,frame002.jpg, etc. - Compresses them into a
.mp4video usingimageio - Extracts frames back from the video
- Compares original and reconstructed frames using:
- PSNR (Peak Signal-to-Noise Ratio)
- SSIM (Structural Similarity Index)
- Outputs graphs and a CSV report with quality metrics
To get started, install the required dependencies:
pip install -r requirements.txt- Python 3.7+
pip install -e .pip install framezipfrom framezip.pipeline import run_pipeline
run_pipeline(
input_folder="frames/",
output_video="video.mp4",
extracted_frames="extracted/"
)from framezip.video import images_to_video
from framezip.extraction import extract_frames
from framezip.metrics import compare_psnr_ssim
images_to_video("frames/", "video.mp4")
extract_frames("video.mp4", "extracted/")
compare_psnr_ssim("frames/", "extracted/", csv_output="metrics.csv")- Support for
.webm,.gif,.avi - Lossless mode with pixel-wise difference export
- Support input video files for analysis
We love contributions! Check out our CONTRIBUTING.md for guidelines.
If you like this project, give it a ⭐ on GitHub or share it with other devs/video nerds 👾
