Self-described engineer, space lover and tea drinker Thomas Poulet defines a movie barcode as follows:
A Movie Barcode is the color identity card of the movie. Basically for each frame you take the dominant color and create a stripe out of it. The result is an overview of the overall mood of the movie.
It is worth noting that this program computes the row-wise average over a batch of frames rather than the dominant or modal color. In practice, this yields a reasonable effect.
Conceptually, my approach uses two key ingredients: a Reader and Process function in alignment with the Producer/Consumer design pattern. The reader is responsible for reading in frames and the workers process a batch of frames into a strip.
Option | Description | Default |
---|---|---|
-f, --file <file> |
Movie file (required) | - |
-r, --rate <rate> |
Sampling rate | 1 |
-b, --batches <batches> |
Number of batches | 100 |
-w, --workers <workers> |
Number of workers | 5 |
-v, --verbose |
Verbose output | false |
-t, --transform |
Transform output | false |
-h, --help |
Display this help message | - |
To generate a barcode with the default settings:
./barcode -f example.mp4
To generate a barcode with a sampling rate of 2, 50 batches, and 10 workers:
./barcode -f example.mp4 -r 2 -b 50 -w 10
To enable verbose output and apply a transform to the output:
./barcode -f example.mp4 -v -t
Feel free to customize further based on your project's requirements and additional information you may want to include.
Here is an example using a compilation of cutscenes from Zelda Breath of the Wild. In post, a filter was applied to brighten colors and squoosh was used to compress the image to a reasonable size.