Answer the question
In order to leave comments, you need to log in
What is the best way to compress video in ffmpeg?
In general, there is a video library and the task is to compress each video up to 1.5GB with minimal loss.
I already have all these codecs / presets / crf / double passes and other garbage that makes my head swell (I have never dealt with video encoding before)
Please advise the appropriate ffmpeg settings for my task. Encoding time is not important (as long as it's not completely terrible like av1)
Answer the question
In order to leave comments, you need to log in
The safest way would be CRF with a bitrate limit:
ffmpeg -i input -c:v libx264 -preset veryslow -crf 23 -maxrate X -bufsize 2M output.mp4
Bitrate in mega bits = file size in gigabytes / (number of minutes * .0075 )
ffmpeg -i input -c:v libx264 -preset veryslow -crf 23 -maxrate 3M -bufsize 2M -acodec aac -b:a 128k output.mp4
ffmpeg -i input -vcodec libx264 -preset veryslow -b:v 3M -pass 1 -an -f mp4 NULThis goodness goes in two consecutive lines to the bat-file, it must be executed one after the other.
ffmpeg -i input -vcodec libx264 -preset veryslow -b:v 3M -pass 2 -acodec aac -b:a 128k output.mp4
ffmpeg -i input -c:v libx265 -preset slower -crf 23 -maxrate 3M -bufsize 2M output.mp4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question