Skip to content

Instantly share code, notes, and snippets.

@motorollerscalatron
Last active January 15, 2016 11:55
Show Gist options
  • Save motorollerscalatron/3d28b5daa54f8f3f45b8 to your computer and use it in GitHub Desktop.
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.
#
# 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