Last active
December 26, 2015 23:40
-
-
Save kevinchappell/368c88ce3147b7a91295 to your computer and use it in GitHub Desktop.
Convert video to 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
[Desktop Entry] | |
Type=Action | |
TargetLocation=true | |
ToolbarLabel[en_US]=Convert to Animated GIF | |
ToolbarLabel[en]=Convert to Animated GIF | |
ToolbarLabel[C]=Convert to Animated GIF | |
Name[en_US]=Convert to Animated GIF | |
Name[en]=Convert to Animated GIF | |
Name[C]=Convert to Animated GIF | |
Profiles=profile-zero; | |
[X-Action-Profile profile-zero] | |
MimeTypes=video/mp4; | |
ExecutionMode=Terminal | |
Exec=~/bin/vid2gif.sh %F %d/%W.gif | |
Name[en_US]=Convert to Animated GIF | |
Name[en]=Convert to Animated GIF | |
Name[C]=Convert to Animated 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/sh | |
ACTIONS_DIR=~/.local/share/file-manager/actions | |
sudo apt-get install nautilus-actions | |
mkdir -p $ACTIONS_DIR | |
mv ./Convert\ to\ Animated\ GIF $ACTIONS_DIR/Convert\ to\ Animated\ GIF | |
chmod +x ~/bin/vid2gif.sh |
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 | |
# vid2gif | |
# converts videos to gifs | |
read -p 'Width (default 540): ' G_WIDTH | |
read -p 'FPS (default 10): ' G_FPS | |
G_WIDTH=${G_WIDTH:-540} | |
G_FPS=${G_FPS:-10} | |
PALETTE="/tmp/palette.png" | |
FILTERS="fps=$G_FPS,scale=$G_WIDTH:-1: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 $2 | |
# remove tmp/palette.png | |
rm -f $PALETTE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment