Inspired by this reddit thread, this script will take all images from a movie, grab each pixel RGB value, add them together then take the average and create a final image like this:
-
Generate frames from selected video using FFmpeg
ffmpeg -i input_file.mp4 -r 1 -f image2 images/images_%20d.png
Notes:
-r 1
Generates 1 frame per second. Modify to your liking. -
Run the script
ruby images.rb
-
Grab a beer. It's going to be a while.
-
Check out your newly generated final.png.
There's probably a better way to do all of this (like RMagick's average
) but I wanted to give it a shot. Any help making this script better would be appreciated!