Fox Row Rowing, computers, astronomy - detect duplicate frames in Video, TV, or Film

The Force Awakens has a lot of shots that are callbacks to A New Hope - they evoke very particular scenes and shots, if not outright identical. That got me thinking about recycling shots in films. How could that be quantified?

A common task in image processing is finding sets of similar images. Often you have a picture, and you want to search for identical or near-identical copies from some large set. A few ways to do this are described here - pHash and dHash in particular are quite effective.

We can use this to our advantage. Given a video clip, we should be able to go frame-by-frame and hash each image. We can then count the number of frames that hash to the same value, telling us how many occurred earlier. I wrote up a python tool to do this:

Retread measures how much any given frame is reused in a video clip. It can be a TV show, online video, any video file you can get your hands on. It spits out nice JSON, so you can plot it nicely via d3.

Now, let’s see what some movies look like. First up is Mad Max: Fury Road, a 2015 action blockbuster with many fast cuts and short shots overall.

Often the most common frame ends up being black. This is usually credits, maybe a handful of frames from the beginning of the movie, and any fade-to-blacks in the middle. This shows up as big, solid bars near the beginning and end. The interesting stuff is in the middle. Here we see Max doesn’t have any monster repetitive sections: mad max duplicate frames

On the other hand, Memento, a film with a nonlinear story, has heavier and more spikes. The film is presented in sort of an outside-in fashion - the end comes first, then the beginning, then back to the end, working toward the middle the whole time: memento duplicate frames

Inception somewhat famously wraps multiple stories within one another, with the narrative jumping between all 3 in parallel. Christopher Nolan directed both Memento and Inception. He seems to be a fan of cutting across time and space. This results in a moderately busy graph: inception duplicate frames

Paprika, one of the inspirations for Inception, has even more. Flashbacks occur throughout the film, and it shows. The chart is almost totally full: paprika duplicate frames

See retread here to analyze your own films, TV shows, or clips.

Posted on Jun 05, 2016