Giter VIP home page Giter VIP logo

frame-interpolation's Introduction

frame-interpolation

Unofficial Pytorch reimplementation of FILM: Frame Interpolation for Large Motion. (Tensorflow 2 implementation can be found here, https://github.com/google-research/frame-interpolation.)

Installation

Install PyTorch following official instructions, e. g.

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

Install pip dependencies,

pip install -r requirements.txt

Usage

INPUT=input.mp4 &&\
OUTPUT=output.mp4 &&\
python run.py -i ${INPUT} -o ${OUTPUT}

Useful ffmpeg commands for video processing

Cropping.

INPUT=input.mp4 &&\
OUTPUT=output.mp4 &&\
LEFT=10 && TOP=0 && WIDTH=256 && HEIGHT=256
ffmpeg -i ${INPUT} -filter:v "crop=${WIDTH}:${HEIGHT}:${LEFT}:${TOP}" ${OUTPUT}

(see, https://ffmpeg.org/ffmpeg-filters.html#toc-crop)

Changing framerate.

INPUT=input.mp4 &&\
OUTPUT=output.mp4 &&\
FPS=30 &&\
ffmpeg -i ${INPUT} -filter:v fps=${FPS} ${OUTPUT}

(see, https://ffmpeg.org/ffmpeg-filters.html#toc-fps-1, or https://trac.ffmpeg.org/wiki/ChangingFrameRate)

Scaling.

INPUT=input.mp4 &&\
OUTPUT=output.mp4 &&\
W=416 &&\
H=416 &&\
ffmpeg -i ${INPUT} -vf scale=${W}:${H} ${OUTPUT}

(see, https://ffmpeg.org/ffmpeg-filters.html#toc-Scaling.)

Split into scenes.

The following command will create a file where for each frame of the specified video a characteristic is calculated, how much this frame differs from the previous one.

INPUT=input.mp4 &&\
ffmpeg -i ${INPUT} -vf "select='gte(scene,0)',metadata=print:file=scores.txt" -an -f null -

Cut fragment from video.

INPUT=input.mp4 &&\
OUTPUT=output.mp4 &&\
START=00:05:20 &&\
DURATION=00:10:00 &&\
ffmpeg -i ${INPUT} -ss ${START} -t ${DURATION} -c:v copy -c:a copy ${OUTPUT}.

Copy audio from one video to another.

INPUTV=input.mp4 &&\
INPUTA=input_with_audio.mp4 &&\
OUTPUT=output.mp4 &&\
ffmpeg -i ${INPUTV} -i ${INPUTA} -c copy -map 0:v:0 -map 1:a:0 -shortest ${OUTPUT}

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.