Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thomaswilley/1d6305ac1191ec905dba10547e7c3b45 to your computer and use it in GitHub Desktop.
Save thomaswilley/1d6305ac1191ec905dba10547e7c3b45 to your computer and use it in GitHub Desktop.
windows screencast w/ffmpeg (& optionally convert to gif)
# record desktop to .mkv which is safely ended via ctrl+c
ffmpeg -y -f gdigrab -i desktop -r 10 -vcodec libx264 -pix_fmt yuv420p output.mkv
# clip some time (in this case 22s) from the start of the video and transcode to .mp4 (a format not safe to end w/ctrl+c)
ffmpeg -ss 00:00:22.0 -i output.mkv output.mp4
# create a palette
ffmpeg -y -i output.mp4 -vf fps=10,scale=768:-1:flags=lanczos,palettegen palette.png
# create the final gif
ffmpeg -i output.mp4 -i palette.png -filter_complex "fps=10,scale=1024:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment