Creating comparison thumbnails for video files
Stills from "The Son of The Stars (1988)," dir. Mircea Toia & Cǎlin Cazan
Creating comparison thumbnails for video files

My Blu-ray collection has been growing. After becoming fully indoctrinated into the Criterion Cult, I started picking up physical copies of the movies I loved. That led to picking up physical copies of movies I think I’ll love. Now I’m buying physical copies of movies I’ve never even heard of before… I digress.

The point is, I’ve got a bunch of Blu-rays to rip to my Plex library. This post isn’t a “How I rip movies using Handbrake” guide. There are enough of those available. This is a quick look at a bash script I wrote that takes a copy of the film exported from its disk by MakeMKV and compares it side-by-side with its Handbrake-encoded copy.

The need

I have a Handbrake preset for Blu-ray’s that I’m never completely happy with, but am content to work from as a basis for most movies. Before I commit my machine to churning out an encode, [1] I like to bounce a single chapter and compare the quality of the picture to see how much is lost with my current video settings.

Of course, opening two VLC windows is a pain and I’m not going to open a Final Cut project just to put two videos side by side. Opening both files individually and taking a screen grab at the same frame is tedious too. I find anything to do with film tedious. But that’s why FFMPEG exists.

The approach

Usually I look to Python for my scripting needs. I’m comfortable there. But I’m coming to learn just how great plain ol’ bash is and opted to go for a shell script instead. This turned into two versions of the script. One relies solely on FFMPEG’s tooling to take screen grabs at regular intervals within the first 30 minutes. The other uses some basic math and a for loop to take them at specific points throughout the entire length of the video. The second one is considerably faster and I’ll focus on that one below.

The script takes the paths of two video files, susses out some information about them like their name, duration, and resolution. It checks that FFMPEG and ImageMagick are installed. FFMPEG does all the heavy lifting in terms of capturing frames while ImageMagick does some work to trim them where necessary and then concatenate them all together at the end.

Note: This script really only works if the pair of videos are identical in length and timed the same. Otherwise, you’re going to get side-by-side images of entirely different frames.

For example, this doesn’t work for comparing different releases of the same movie like CJ Entertainment and Criterion’s releases of Memories of Murder.

The Result


  1. This is MUCH faster on my new M2 Studio. ↩︎

After working through the videos and their resulting captures, what you get is a folder of individual frame comparisons as well as a stitched version of all of them at once. The second version of my script limits this to 4, which I find adequate 98% of the time due to how spread out they are in the film. [1]

Every image also shows file information to show not only which file produced which screen grab, but also the file’s size. After all, the point of this exercise is to help me determine the quality to size ratio of my encodes.


  1. I chose to capture frames at the following percentages: 12.5, 37.5, 62.5, 87.5. This avoids credits and title cards while showing a wider range of the film. ↩︎

The full frame sheet does a good enough job of comparing loss in quality. For most of my H265 encodes, the difference is barely discernible despite space savings of 70-90%. The individual comparisons make it easier to zoom in on troublesome areas like shadows and fine edges or grain.

What’s next

I’ve been iterating on this here and there for a few weeks and will likely continue to do so. I’d like to wrap this in a basic GUI for MacOS that would allow me to more easily tweak settings here and there. I’d love to work out how to adjust the timing of one or both files to allow for side-by-side comparisons of videos from different sources.

I hope someone finds the script helpful.