Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Last active December 3, 2025 16:49
Show Gist options
  • Select an option

  • Save lukehedger/277d136f68b028e22bed to your computer and use it in GitHub Desktop.

Select an option

Save lukehedger/277d136f68b028e22bed to your computer and use it in GitHub Desktop.
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@dennisdebel
Copy link

./ffmpeg -i input.mp4 -c:v libx265 -preset ultrafast -crf 28 -c:a aac -b:a 250k output.mp4

This is better for h265, it's fast and should reduce the file size by 50-70% if you want better video, change the ultrafast to fast or change the -crf to a lower number like 24

If you want to change from 4K to 1080P, add -s 1920x1080 after the -i input.mp4

h256 does not seem to work in ios safari

@Leahlilili
Copy link

Maybe this article can help you. It provides top 6 Video Compressors, including how to compress mp4 using FFMPEG
https://fliflik.com/video-tips/video-compressor-for-discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment