Skip to content

Instantly share code, notes, and snippets.

@rewida17
Created November 30, 2017 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rewida17/f63802ca23b833a6b0d608363fc3bc0c to your computer and use it in GitHub Desktop.
Save rewida17/f63802ca23b833a6b0d608363fc3bc0c to your computer and use it in GitHub Desktop.
FFMPEG GIF Create
#!/bin/bash
usage()
{
echo -e "\\nUsage:\\n ./gifmake \\n [Wejściowe Wideo] [Nazwa Końcowa Pliku GIF] [Roździelczość Pozioma] [(fps)] [czas początku( HH:MM:SS.MSS)] [czas końca (HH:MM:SS.MSS) ]"
}
if [[ ( $@ == "--help") || $@ == "-h" ]]
then
usage
exit 0
fi
palette="/tmp/palette.png"
filters="fps=$4,scale=$3:-1:flags=lanczos"
rm -rf /tmp/*mp4 "$palette"
cp "$1" /tmp/
echo "format is a: ss.mss"
ffmpeg -v warning -ss "$5" -i /tmp/"$1" -to "$6" -c copy /tmp/prt.mp4
#"$5"= time of start "$6"= duration in seconds
ffmpeg -v warning -i "/tmp/prt.mp4" -vf "$filters,palettegen" -y "$palette"
ffmpeg -v warning -i "/tmp/prt.mp4" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2"
#ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y "$palette"
#ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment