Created
September 15, 2015 19:48
-
-
Save nuclearghost/95dce613b8e24454ed6c to your computer and use it in GitHub Desktop.
Create a gif from a mp4 using ffmpeg
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 | |
input_video=$1 | |
starting_second=$2 | |
lenght_in_seconds=$3 | |
output_file=$4 | |
palette="/tmp/palette.png" | |
filters="fps=15,scale=320:-1:flags=lanczos" | |
ffmpeg -ss $starting_second -t $lenght_in_seconds -i $input_video -vf "$filters,palettegen" -y $palette | |
ffmpeg -ss $starting_second -t $lenght_in_seconds -i $input_video -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $output_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment