Created
October 1, 2017 10:12
-
-
Save jemsgit/6214136d970d0736efc4a3b3576b0c6f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
#FileName | |
FileName=$1 | |
#Start time | |
echo "Введите начальное время" | |
read StTime | |
#Length of video | |
echo "Введите продолжительность" | |
read LenV | |
#Quantity images per sec | |
echo "Введите число кадров в секунду" | |
read R | |
#Width of images | |
echo "Введите ширину изображения" | |
read WIDTH | |
#Speed of gif | |
echo "Введите задержку gif" | |
read DEL | |
DestName='resized_im'; | |
VideoImages='frames'; | |
mkdir $DestName; | |
mkdir $VideoImages; | |
#Cut video | |
ffmpeg -ss "$StTime" -t "$LenV" -i "$FileName" -vcodec copy -acodec copy out.MOV; | |
#Convert video to images | |
ffmpeg -i out.MOV -r "$R" "$VideoImages"/image_%010d.png; | |
echo "Раскадровка завершена. Ресайзинг..." | |
#Resize images | |
cd $VideoImages | |
for i in image_*.png; do convert $i -resize "$WIDTH" ../"$DestName"/$i; done | |
echo "Ресайз завершен. Конвертирование..." | |
cd ../$DestName; | |
#Make gif | |
convert -delay "$DEL" -layers optimize *.png ../animation.gif | |
cd .. | |
rm out.MOV; | |
rm -rf $DestName; | |
rm -rf $VideoImages; | |
echo "Успешно" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment