Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Last active May 2, 2025 14:50
Show Gist options
  • Save lukehedger/277d136f68b028e22bed to your computer and use it in GitHub Desktop.
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
@kfnx
Copy link

kfnx commented Apr 25, 2025

ffmpeg -i video.MOV -c:v h264 -c:a aac -strict -2 -pix_fmt yuv420p -q:v 0 video.mp4
I convert mov to mp4 and the result is good enough: 985 mb -> 358mb

ffmpeg -i video.mp4 -vcodec libx264 -crf 23 -preset medium -acodec aac -b:a 128k video-compressed.mp4
Next i want to compress it, got: 360 mb -> 302 mb

ll video*
-rw-r--r-- 1 kafin kafin 986M Apr 25 10:17 video.MOV
-rw-r--r-- 1 kafin kafin 360M Apr 25 10:29 video.mp4
-rw-r--r-- 1 kafin kafin 302M Apr 25 10:44 video-compressed.mp4

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