Skip to content

Instantly share code, notes, and snippets.

@jngnyc
Created July 18, 2018 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jngnyc/235b3029e87b14a99c39ff1543e14ec4 to your computer and use it in GitHub Desktop.
Save jngnyc/235b3029e87b14a99c39ff1543e14ec4 to your computer and use it in GitHub Desktop.
#!/bin/sh
start_time=0
duration=0
fps=10
scale=640
palette="/tmp/palette.png"
filters="fps=$fps,scale=$scale:-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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment