Skip to content

Instantly share code, notes, and snippets.

@wotori
Last active October 6, 2023 15:28
Show Gist options
  • Save wotori/86497815a4fed0df7be60498f4795101 to your computer and use it in GitHub Desktop.
Save wotori/86497815a4fed0df7be60498f4795101 to your computer and use it in GitHub Desktop.
super compress
# 1. Compress a video to the smallest possible size
ffmpeg -i input.mp4 -vf "scale=iw/2:ih/2" -c:v libx265 -preset ultrafast -crf 28 -c:a aac -b:a 64k output.mp4
# 2. Remove audio from a video
ffmpeg -i input.mp4 -an output.mp4
# 3. Convert a video to a GIF
ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" output.gif
# 4. Convert a specific part of a video to a GIF (from 30s, duration 10s)
ffmpeg -ss 30 -t 10 -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" output.gif
# 5. Make a GIF play faster by increasing the frame rate
ffmpeg -i input.gif -vf "fps=30" output-fast.gif
# 6. Create a faster playing GIF with a smaller size by reducing frame rate and resolution
ffmpeg -i input.mp4 -vf "fps=15,scale=320:-1:flags=lanczos" output-smaller.gif
# 7. Optimize a GIF's file size with Gifsicle
gifsicle -O3 -o optimized.gif input.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment