I recorded a short screen cast of a demo I built. It was ~900KB - way too large to publish as a thumbnail. So I asked ChatGPT:
What's the best equivalent of squoosh.app for WEBM compression? I'm looking for a free modern high-quality online video compressor.
There are a few, and they compressed it to a third of its size, but 300KB is still too large. So I attached the original and asked:
I am compressing screenshots like this. They're often not large. I don't mind cropping the edges by a few pixels to make it a multiple 2, 4, or 8 if that'll help. I certainly am OK with a lower frame rate. I'd like an image quality that a human eye can just SLIGHTLY detect as worse than the original, but only VERY SLIGHTLY.
What's the best way of using ffmpeg or similar tools to compress such a file?
Think like an expert:
- What would an expert in this field check that beginners would miss?
- What patterns would an expert in this field recognize that beginners would miss?
- In this context, what questions would an expert ask that a beginner would not know to?
- If this goes wrong, what are the most likely reasons?
... and list the best (diverse, testing different hypotheses) compression command options.
Run them on this video and let me download the resulting videos for visual comparison. Interview me. Give me a list of questions that I can easily answer by looking at the videos and I'll share those with you to help you decide the best compression command for me.
This leverages 3 tricks.
Claude did a good job of showing different versions and compressing it, but as expected, ChatGPT was the obsessive perfectionist. It gave me a huge set of variations of:
... and asked me to compare between them, like these:
The final result is this script:
ffmpeg -hide_banner -stats -v warning -i "$input"
-vf "crop=iw-mod(iw\,2):ih-mod(ih\,2),fps=$fps"
-c:v libsvtav1 -preset 8 -crf $crf -pix_fmt yuv420p
-an "$output"
... which does the following:
I realized that for the resolution I'll likely see this at, very low frame rates (5 fps) and poor compressions (CRF 55) are good enough.
My original video was 912KB. The smallest video that looks good enough for me is 23 KB. That's almost a 40x compression!
Things I'm taking away:
Video: Watch video
Video: Watch video
Video: Watch video
The final result is this script:
ffmpeg -hide_banner -stats -v warning -i "$input"
-vf "crop=iw-mod(iw\,2):ih-mod(ih\,2),fps=$fps"
-c:v libsvtav1 -preset 8 -crf $crf -pix_fmt yuv420p
-an "$output"
... which does the following:
I realized that for the resolution I'll likely see this at, very low frame rates (5 fps) and poor compressions (CRF 55) are good enough.
My original video was 912KB. The smallest video that looks good enough for me is 23 KB. That's almost a 40x compression - small enough to publish in my data story.