/moviespectrum

Primary LanguageGoApache License 2.0Apache-2.0

moviespectrum

A command line tool to generate the color spectrum for a given input video file.

Source video Result Spectrum

Usage

Command Line

Build:

go build -o moviespectrum-cli cmd/moviespectrum/cli.go

Prepare a video file, e.g. download it from youtube:

youtube-dl --format 160 https://www.youtube.com/watch?v=3-HiGBJ7nJ0

Run the tool:

./moviespectrum-cli 'KikoRiki Ep. 6 - Season 3 - The Border-3-HiGBJ7nJ0.mp4'

The resulting spectrum image file is saved to the file with the same file name as the source video with additional ".png" extension.

Web

Build:

go build -o moviespectrum-rest-service cmd/moviespectrum/rest_service.go

Run the service:

./moviespectrum-rest-service

Then, open http://localhost:8080 in a browser

Cloud

https://moviespectrum.azurewebsites.net/

How it works

  1. Convert the source video to 256x144 RGB frames
  2. Convert each pixel to HSL
  3. Spectrum X axis is pixel's Hue
  4. Color weight = Saturation * Median lightness difference
  5. Median lightness difference = chi square difference for the pixel's lightness and lightness range middle

Some popular movies

Year Source Video Link Result Spectrum
1975 Jaws - Theatrical Trailer (HD) (1975)
1977 Star Wars A New Hope 1977 Trailer
1985 Back To The Future (1985) Theatrical Trailer - Michael J. Fox Movie HD
1991 Terminator 2: Judgment Day (1991) Trailer #1 Movieclips Classic Trailers
1993 Jurassic Park Trailer
1994 Pulp Fiction (1994) Official Trailer - Samuel L. Jackson, John Travolta Movie HD
1994 The Lion King - Original Release Trailer (1994)
1994 Forrest Gump - Trailer
1995 Braveheart Trailer - 1995 HQ
1997 Titanic (1997) - Original Trailer
1999 Matrix Trailer HD (1999)
2001 Shrek 2001 Official Trailer
2003 The Lord of the Rings: The Two Towers (2002) Official Trailer #2 - Orlando Bloom Movie HD
2003 Pirates of the Caribbean: The Curse of the Black Pearl Official Trailer 1 (2003) HD
2007 Transformers (2007) - Full Trailer HD
2008 The Dark Knight - Official Trailer 2 HD
2009 AVATAR Official Final Trailer (2009) James Cameron Sci-Fi Action Movie HD
2012 Marvel's The Avengers Trailer 2 (OFFICIAL)
2013 Oblivion Official Trailer #1 Tom Cruise Sci-Fi Movie HD
2014 Interstellar - Trailer - Official Warner Bros. UK
2014 Disney's Maleficent - Official Trailer 3
2015 Mad Max: Fury Road - Official Main Trailer
2015 Ex Machina
2016 Arrival Trailer (2016) - Paramount Pictures
2017 Alien: Covenant
2019 Joker Final Trailer (2019)
2019 Ad Astra
2020 TENET - Official Trailer