Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created May 25, 2020 14:00
Show Gist options
  • Save prafullakumar/388fba01f26f79f6539db02b42591ae3 to your computer and use it in GitHub Desktop.
Save prafullakumar/388fba01f26f79f6539db02b42591ae3 to your computer and use it in GitHub Desktop.
#!/bin/sh
start_time=0:0
duration=35
ffmpeg -i $1 -vf palettegen palette.png
palette="./palette.png"
filters="fps=15,scale=320:-1:flags=lanczos"
ffmpeg -v warning -ss $start_time -t $duration -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -ss $start_time -t $duration -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
rm palette.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment