I was recently shown a fascinating way of displaying an entire movie in one image. They have been nick named ‘movie barcodes’. It consist of the average colour of certain frames in a movie, displayed left to right in one image.
It’s a really interesting and unique representation of a movie. You can instantly see how the colour and luminance choices within a movie complement and contrast with each other. When watching a movie we can’t see the bigger picture. But here it is all laid out to see.
I wanted to make a movie barcode for the Aliens – Special Edition (1986) in Nuke.
Some challenges in Nuke:
- Creating an automated way to set the frames.
- Extracting the average colour of the chosen frame, ideally automatically.
- How to display the frames.
Setting the Frames
I started by trying Python – scripting the creation of FrameHold nodes. This turned out to be very fiddly and not easy to adjust later, not the way to go.
I also tried using a FrameHold with two keyframes. Frame 1 = 1, Frame 2 = 270. Then in the curve editor setting the curve ‘After’ to ‘Linear’. This continues the time offset beyond the last keyframe. It achieved the correct result but was a little tricky to control and changing the value of the 2nd keyframe changed how many frames would be displayed.
I needed something that was easy to control and would let me set the amount of frames I wanted to display, letting Nuke take care of the time offset automatically.
Enter the Retime node.
With the Retime node you can not only set the output range you can also set the input range. Being able to adjust the input range was great as it meant I could easily remove the opening idents and the credits (not so fun to see… as they are mostly black).
For the output range I settled on 4000 frames.
Extracting the Average Colour of a Frame
I looked into doing this a number of ways.
I tried scaling the image down, blurring and then scaling the image back to the full resolution. This gave an average colour of the frame but was incredibly slow when trying to display 4000 frames!
I also discovered a way of getting the average colour of a frame using TCL script from this Nuke Forum post. It uses a Rectangle node which samples to input image. It worked well when moving the playhead to each frame but would not display properly when plugged into a ContactSheet.
I’m guessing the TCL needs to be run for each frame individually so displaying 4000 frames at once doesn’t work. Could be useful in the future but not for this project.
I finally settled on the simplest option, the CurveTool. With this node you can sample the average intensities of an image. Once run the average intensities can be pasted into a Constant. This way is super fast to display but if anything changes upstream the CurveTool must be run again. Not quite as automatic as I wanted it but I felt this was an adequate solution.
And Voilà! Each of the frames average colour is displayed in the Constant!
Displaying the Frames
I used the ContactSheet node set to display frames instead of images to render my movie barcode. I set each of the frames to be displayed as 1 pixel wide and 1 pixel high. I then used a Crop to stretch each of the 1×1 pixels up.
I’ve uploaded my final script to GitHub.
The Final Product!
Once the system was set up it was very easy to put other films through the process. So… of course I had to do Alien and Alien 3!
Many thanks to Lev Kolobov, Zissis Papatzikis and Cameron Smither for help with this project.