Created
August 3, 2019 03:05
-
-
Save cskonopka/1e683cef107bca248473e651f9d26b2b to your computer and use it in GitHub Desktop.
Search a directory for .mp4 files, create a .png using the "palettegen" filter and then generate a new gif using the .png and source .mp4
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 | |
echo "Provide a directory please :" | |
read dir | |
for f in $dir/*.mp4 | |
do | |
echo "Processing $f" | |
echo "${f%.*}.png" | |
ffmpeg -y -ss 0 -t 11 -i $f -filter_complex "[0:v] palettegen" "${f%.*}.png" | |
ffmpeg -ss 0 -t 11 -i $f -filter_complex "[0:v] fps=24,scale=w=480:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1" "${f%.*}.gif" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment