Last active
June 14, 2016 14:12
-
-
Save dobladov/359600061655575e7b65 to your computer and use it in GitHub Desktop.
Simple video to gif converter with ffmpeg and zenity
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/sh | |
width=$(zenity \ | |
--entry \ | |
--title "Gif Generator" \ | |
--text "Width" \ | |
--entry-text "-1" ); | |
if [ -z $width] | |
then | |
exit | |
fi | |
height=$(zenity \ | |
--entry \ | |
--title "Gif Generator" \ | |
--text "Height" \ | |
--entry-text "-1" ); | |
if [ -z $height] | |
then | |
exit | |
fi | |
fps=$(zenity \ | |
--entry \ | |
--title "Gif Generator" \ | |
--text "Fps" \ | |
--entry-text "15" ); | |
if [ -z $fps] | |
then | |
exit | |
fi | |
name=$(zenity \ | |
--entry \ | |
--title "Gif Generator" \ | |
--text "Name" \ | |
--entry-text "${1%%.*}" ); | |
if [ -z $name] | |
then | |
exit | |
fi | |
notify-send -i "multimedia-video-player" "Gif Generator" "Gerating Gif!" | |
palette="/tmp/palette.png" | |
filters="fps=$fps,scale=$width:$height:flags=lanczos" | |
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 $name".gif" | |
notify-send -i "multimedia-video-player" "Gif Generator" "Finished!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment