Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Last active April 9, 2025 09:08
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
@QiuChristine1025
Copy link

@deroverda
Copy link

Commands using Linux with ffmpeg to shrinking big MP4 video file to smaller sizes

  • ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 out.mp4
    • 3.6 Gb to 556 Mb, great quality 🥇
  • ffmpeg -i input.mp4 -s 1280x720 -acodec copy -y output.mp4
    • 3.6 Gb to 62 Mb, quality "good enough"/acceptable 👍
  • ffmpeg -i input.mp4 -vcodec h264 -b:v 1000k -acodec mp3 output.mp4
    • 3.6 Gb to 30 Mb, very shitty quality 💩

Thanks for sharing, really helpful!

do these commands work just the same way on windows 10?

@Doraa789
Copy link

Doraa789 commented May 6, 2024

Thanks for sharing. I found that StreamFab can help you convert Netflix to MP4, then you can play them on most devices. You can learn more by https://streamfab.com/ .

@Leila9776
Copy link

Great discussion !
By the way if you want some dvd processing tools, theses one are highly recommanded.
https://dvdfab.fr/uhd-copy.htm
https://dvdfab.fr/dvd-copy.htm

@staygold24
Copy link

Read this article published by KeepStreams very helpful

@xggtta
Copy link

xggtta commented Jan 16, 2025

After conversion, would you think about enhancing the video quality? Here an AI video enhancer software offers a turnkey solution.

@DamonTsang986
Copy link

Wouldn't it be much easier to use video compressor software? There are quite a few wonderful and high quality video compressors out there.

@jedomed
Copy link

jedomed commented Feb 23, 2025

Wouldn't it be much easier to use video compressor software? There are quite a few wonderful and high quality video compressors out there.

ffmpeg is video compression software (among many other things), as far as I can tell the only difference is that you run it from a command line instead of a GUI, and it's free.

@somaGFX
Copy link

somaGFX commented Mar 27, 2025

does anyone know why I do not get any audio when I use ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 or ffmpeg -i input.mp4 -vcodec h264 -acodec mp3 output.mp4?

I found a solution that works with ffmpeg -i input.mp4 -vcodec h264 -acodec copy output.mp4 but it does not solve the problem with the audio converting and I would really like to know what's the problem with the audio

tbh I got a pretty niet 650M file out of 2.7G

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