Last active
April 12, 2018 07:16
-
-
Save mmautner/9552919eea4a4e16195e31a20bcdeba4 to your computer and use it in GitHub Desktop.
make a simplistic multi-frame animation with Python + ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
convert -loop 0 -delay 30 -resize 683x512\! *.png out.gif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, glob, shutil | |
import logging | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger(__name__) | |
arg = sys.argv[1] | |
logger.info('locating files matching "{}*"'.format(arg)) | |
files = glob.glob('{}*.png'.format(arg)) | |
logger.info('\t{}'.format(files)) | |
PATTERN = "img%03d.png" | |
for i in xrange(100): | |
src = files[i % len(files)] | |
dest = PATTERN % i | |
logger.info("copying {} to {}".format(src, dest)) | |
shutil.copyfile(src, dest) | |
logger.info("ffmpeg -framerate 10 -i image%03d.png -s:v 1280x720 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p out.mp4") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video/