Last active
August 20, 2022 22:21
-
-
Save jemsgit/8622615 to your computer and use it in GitHub Desktop.
cut movie and make gif
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
#!/bin/bash | |
#Start time | |
StTime="00:02:31" | |
#Length of video | |
LenV="00:00:05" | |
#Quantity images per sec | |
R="4" | |
#Width of images | |
WIDTH="600" | |
#Speed of gif | |
DEL="10" | |
#Cut video | |
ffmpeg -ss "$StTime" -t "$LenV" -i video.MOV -vcodec copy -acodec copy out.MOV; | |
#Convert video to images | |
ffmpeg -i out.MOV -r "$R" image_%010d.png; | |
#Resize images | |
mkdir resized; | |
for i in image_*.png; do convert $i -resize "$WIDTH" resized/$i; done | |
rm -f image_*.png; | |
cd resized; | |
#Make gif | |
convert -delay "$DEL" -layers optimize *.png ../ani.gif | |
cd ..; | |
rm -fr resized; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment