Skip to content

Instantly share code, notes, and snippets.

@cknd
Last active March 18, 2021 16:00
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 cknd/c61f841040884759e54ef4a9cc398604 to your computer and use it in GitHub Desktop.
Save cknd/c61f841040884759e54ef4a9cc398604 to your computer and use it in GitHub Desktop.
magic ffmpeg calls
# pack a bunch of images into a nice-looking gif running at 5 fps (with rescaling and a proper color palette)
ffmpeg -f image2 -r 5 -i %*.png -vf "scale=450:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" out.gif
# convert section of video to gif (with palette, rescale and slowdown)
ffmpeg -ss 00:00:43 -to 00:00:49.5 -i input.mp4 -r 15 -vf "scale=300:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse,setpts=2.0*PTS" out.gif
# shrink a video (half the size and _slightly_ lower quality)
ffmpeg -i input.mp4 -vf scale="iw/2:ih/2" -crf 30 output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment