Skip to content

Instantly share code, notes, and snippets.

@scips
Last active August 19, 2019 14:39
Show Gist options
  • Save scips/aed7733aac2cb47a69e5 to your computer and use it in GitHub Desktop.
Save scips/aed7733aac2cb47a69e5 to your computer and use it in GitHub Desktop.
stop motion with image magick and ffmpeg
## Rename file
j=1;for i in `ls`; do prt=$(printf '%04d' $j);j=$((j + 1));echo "mv $i $prt.JPG"; mv $i "$prt.JPG"; done
## crop
mogrify -crop 1920x1080+362+628 *.jpg
## or resize
mogrify resize 1920x1080 *.jpg
## morph if necessary !!! takes time
convert *.jpg -delay 10 -morph 10 %05d.morph.jpg
## create movie
ffmpeg -r 25 -i %05d.morph.jpg output.mp4
## or
ffmpeg -r 12 -i "%04d.JPG" totoro.mp4
@hydroid7
Copy link

hydroid7 commented Feb 19, 2019

And if you only want only images renamed in your dir, you have to change the first line from:

j=1;for i in `ls`; do...

to

j=1;for i in `ls | grep -E ".png|.jpg|.jpeg|.PNG|.JPG|.JPEG"`; do... 

Here is my fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment