Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Last active June 18, 2025 09:58
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
@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

@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

@tristanz1313
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

Free YouTube to Mp3 Converter Online: ytmp3.love

@JeffersonTan
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.

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.

I think you replied to a bot lol

@Lucifer-Francessa
Copy link

http://v-y2mate.com/
With the useful tool in converting videos from YouTube to MP3 forms

@Dinesh6777
Copy link

Dinesh6777 commented May 24, 2025

Here is the format using latest encoding algorithms h265 and mp3. It's around 15% better than h264.

  • Good quality(reasonable)
    • ffmpeg -i input.mp4 -s 1280x720 -c:v libx265 -preset medium -acodec libmp3lame -y output.mp4
    • 2.45 GB 131MB
  • For Best quality remove scaling paramater "-s"
    • ffmpeg -i input.mp4 -c:v libx265 -preset medium -acodec libmp3lame -y output.mp4

@DamonTsang986
Copy link

DamonTsang986 commented Jun 18, 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.

Agreed. But for those who are not skillful in coding and programming, a software with simple GUI, especially when it's free, would be much easier to use.

@lfuelling
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.

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.

Agreed. But for those who are not skillful in coding and programming, a software with simple GUI, especially when it's free, would be much easier to use.

But you will learn way more from using ffmpeg (which you would anyways with the GUI, just with extra steps, and probably some adware, or a paywall too).

@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.

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.

Agreed. But for those who are not skillful in coding and programming, a software with simple GUI, especially when it's free, would be much easier to use.

But you will learn way more from using ffmpeg (which you would anyways with the GUI, just with extra steps, and probably some adware, or a paywall too).

Agreed, from the aspect of learning.

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