Last active
January 15, 2016 11:55
-
-
Save motorollerscalatron/3d28b5daa54f8f3f45b8 to your computer and use it in GitHub Desktop.
renames photos uploaded from smartphone using flickr uploader to numerically ordered file names for ffmpeg.
This file contains 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
# | |
# preparation: | |
# download all flickr photo files from a certain album from flickr. | |
# it may be separated into a few zip files, | |
# so be sure to expand all of them into the same folder | |
# move to the image folder | |
#1. rename jpeg files named like kimg2150_23977558372_o.jpg | |
# This can be applied to image files with some ordered numbers somewhere in file name. | |
# (change initial values and substring offsets) | |
x=1; | |
for f in *.jpg | |
do | |
foo=${f} | |
foo=${foo:4:7} | |
mv $f $(printf "%04d.jpg" $x) | |
x=$((x+1)) | |
done | |
#2. if photos is upside down, rotate them | |
for f in *.jpg | |
do | |
foo=${f} | |
foo=${foo:1:4} | |
jpegtran -rotate 180 --copy all $f > $foo.jpeg | |
done | |
#3. then make movie | |
ffmpeg -r 15 -i %04d.jpg -vcodec libx264 -qscale:v 0 video.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment