Last active
August 19, 2019 14:39
-
-
Save scips/aed7733aac2cb47a69e5 to your computer and use it in GitHub Desktop.
stop motion with image magick and 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
## 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 |
In the first row this would be shorter:
j=1;for i in `ls`; do prt=$(printf '%04d' $j);j=$((j + 1));mv -v $i "$prt.JPG"; done
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...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@scips, line 6 should be
mogrify -resize 1920x1080 *.jpg
(dash before resize)