Giter VIP home page Giter VIP logo

py-color-cycler's Introduction

Takes an image and creates a color-cycled mp4 accompanied by the supplied music.

Step 1: Create images

Run the python code to turn the given image into 100 color cycled jpegs. First you'll need to pip install a few packages:

  • pip install opencv-python
  • pip install numpy
  • pip install Pillow
  • pip3 install progressbar2

Then run: $ python color_cycle.py sky-diamonds.jpg

Step 2: Turn images into mp4

$ ffmpeg -r 10 -i sky-diamonds-%02d.jpg -vcodec mpeg4 -y movie.mp4

(r is framerate in FPS)

Step 3: Create output mp4

$ ffmpeg -loop 1 -t 439 -framerate 10 -i sky-diamonds-%02d.jpg -i song.mp3 -c copy -c:v libx264 -map 0:v:0 -map 1:a:0 output.mp4

t is the duration of the song in seconds. The "-c:v libx264" option makes it take longer but creates a much smaller output

Step 4: Delete intermediate images

$ rm sky-diamonds-%02d.jpg

Optional: Create an animated gif

Install imagemagick (brew install imagemagick)

convert -delay 0 -loop 0 *-??.jpg sky-diamonds.gif

References

https://stackoverflow.com/questions/44947505/how-to-make-a-movie-out-of-images-in-python https://video.stackexchange.com/questions/12905/repeat-loop-input-video-with-ffmpeg https://superuser.com/questions/590201/add-audio-to-video-using-ffmpeg

py-color-cycler's People

Contributors

monktastic avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.