Giter VIP home page Giter VIP logo

neural-style-video's Introduction

neural-style-video

Application of Gatys' neural style transfer algorithm to video.

Much of the following is lifted from Gene Kogans instructions.

  1. Extract frames from video using ffmpeg

    ffmpeg -i myMovie.mp4 -r 12 -f image2 image-%5d.jpg ffmpeg -i myMovie.mp4 rawaudio.wav

This will extract frames at 12 fps.

  1. Install and run jcjohnsons implementation of the neural style transfer algorithm, with dependencies.

  2. Run the neural style transfer algorithm.

    th neural_style.lua -style_image myStyle.jpg -content_image image-00001.jpg -output_image generated-00001.jpg

  3. Calculate optical flow, morph and blend in the stylized image.

    python opticalflow.py --input_1 image-00001.jpg --input_1_styled generated-00001.jpg --input_2 image-00002.jpg --output blended-00001.jpg --alpha 0.05 --flowblend False

(The flowblend option will set scale the opacity according to the amount of motion - I didn't get good results with this, so you should probably set it to false)

  1. When all frames are blended, you can merge them back into a video by calling

    ffmpeg -framerate 12 -i generated-%05d.png -i rawaudio.wav -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p myMovie.mp4

neural-style-video's People

Contributors

larspars avatar

Watchers

 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.