Skip to content

Instantly share code, notes, and snippets.

@dvlden
Last active April 17, 2024 19:53
Show Gist options
  • Save dvlden/b9d923cb31775f92fa54eb8c39ccd5a9 to your computer and use it in GitHub Desktop.
Save dvlden/b9d923cb31775f92fa54eb8c39ccd5a9 to your computer and use it in GitHub Desktop.
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
-b:v 1000, 2500, 5000, 8000 Video Bitrate
-vf scale -1:X Resize Video (X is height)
-qmin 10 -qmax 42 ??? https://gist.github.com/dvlden/b9d923cb31775f92fa54eb8c39ccd5a9#gistcomment-2972745
MP4 - 1080p

ffmpeg -i input.mov -preset slow -codec:a libfdk_aac -b:a 128k -codec:v libx264 -pix_fmt yuv420p -b:v 4500k -minrate 4500k -maxrate 9000k -bufsize 9000k -vf scale=-1:1080 output.mp4

MP4 - 720p

ffmpeg -i input.mov -preset slow -codec:a libfdk_aac -b:a 128k -codec:v libx264 -pix_fmt yuv420p -b:v 2500k -minrate 1500k -maxrate 4000k -bufsize 5000k -vf scale=-1:720 output.mp4

MP4 - 480p

ffmpeg -i input.mov -preset slow -codec:a libfdk_aac -b:a 128k -codec:v libx264 -pix_fmt yuv420p -b:v 1000k -minrate 500k -maxrate 2000k -bufsize 2000k -vf scale=-1:480 output.mp4

MP4 - 360p

ffmpeg -i input.mov -preset slow -codec:a libfdk_aac -b:a 128k -codec:v libx264 -pix_fmt yuv420p -b:v 750k -minrate 400k -maxrate 1000k -bufsize 1500k -vf scale=-1:360 output.mp4

@dvlden
Copy link
Author

dvlden commented Jul 21, 2021

@vodolaz095 Thank you! Fixed!

@FloStar3000
Copy link

Hi, overall very helpful, thank you very much! But for the command flags table, the video bitrates -b:v say 1000, 2500, 5000, 8000 by rather should be 1000k, 2500k, 5000k, 8000k. I encoded a video with 2500 bit and well, its kind ugly :D

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