From 10,000 frames to 30 moments: Building a visual story compressor
Two hours at 2fps is around 14,000 frames. Most of them are noise: the cursor blinks, the system clock ticks, nothing in the code moved. The first step isn't clever. It's just getting rid of those. ProgressCut is a local macOS app that turns a coding session into a short visual story. No talking, no editing. You hit stop and it hands you a GIF. Here's how the algorithm actually works. Source…
ProgressCut converts a coding session into a short visual story, producing a GIF after the user stops the recording. The algorithm goes through five stages, removing different types of redundant frames.
The first stage employs dHash, which eliminates identical frames. By resizing the frames to 9×8 pixels and converting them to greyscale, it calculates a hash for each pixel and checks for differences by XORing the hashes. Frames with a Hamming distance of ≤ 8 are considered duplicates and removed. Approximately 89% of frames are discarded in this stage, reducing the frame count from 10,847 to 1,203.
The second stage uses SSIM to filter out boring frames. Although dHash removes visually identical frames, many remaining frames appear slightly different due to minor changes in the cursor or status bar. SSIM scores the visual similarity between consecutive frames based on luminance, contrast, and spatial structure. Frames with a score close to 1, indicating no change, are discarded. This stage further reduces the frame count to 284.
The third stage segments the frames into regions, computes SSIM for each region, and averages the scores. By dividing the frame into 16 regions, SSIM can better capture minor changes in specific areas without penalizing overall visual changes. After this stage, the frame count drops to 48.
Finally, the last stage selects the most significant moments from the remaining frames, resulting in a 30-second visual story. This final stage ensures the compressed visualization highlights the most noteworthy events in the coding session.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.