Skip to content

Instantly share code, notes, and snippets.

@overplumbum
Last active September 27, 2015 04:08
Show Gist options
  • Save overplumbum/1208936 to your computer and use it in GitHub Desktop.
Save overplumbum/1208936 to your computer and use it in GitHub Desktop.
Video clip from frames generation
## Windows: http://en.cze.cz/Images-to-video
## MacOSX & Linux below
clipdir=/tmp/clip/
rm -fr $clipdir && mkdir $clipdir
# crop&resize 3x4 frames to 16x9 1280x720
for i in *.JPG ; do convert -verbose $i -strip -resample 72x72 -crop x1386+0+100 -resize 1280x $clipdir/$i ; done
#:> cmds.lst && for i in *.JPG ; do echo convert -verbose $i -strip -resample 72x72 -crop x1386+0+100 -resize 1280x $clipdir/$i >> cmds.lst ; done
#parallel ... todo ...
# renaming frames to 0000.jpg, 0001.jpg, ...
python -c "import os, glob; [os.rename(f, '$clipdir/{0:04d}.jpg'.format(n)) for n, f in enumerate(sorted(glob.glob('$clipdir/*.JPG')))]"
# frames2video
ffmpeg -r 25 -i $clipdir/%04d.jpg -b:v 8M $clipdir/clip.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment