ffmpeg : How to reduce size of a video file

English Русский Español ภาษาไทย 中文 한국어 日本語
Update 21 FEB 2024 vr180g.com
ffmpeg
DanceXR : ffmpeg
Tips

VP9(-c:v libvpx-vp9) is good. However, there are software that cannot play VP9 videos on Android smartphones etc.
I'm trying to find ways to reduce file size without reducing image quality too much.
I need trial and error.

VP9(-c:v libvpx-vp9)

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 9000K -speed 3 output.mp4
example 1.14G -> 208M.
-b:v reduces the size even smaller. (example -b:v 5000K)

The larger the value of the -speed, the faster the conversion. (example -speed 6)

H.264(-c:v libx264)

ffmpeg -i input.mp4 -c:v libx264 -b:v 9000K output.mp4
There are many environments that can be played.
-b:v reduces the size even smaller. (example -b:v 5000K)

HEVC(H.265)(-c:v hevc_nvenc) + NVIDIA GPU encode

ffmpeg -i input.mp4 -c:v hevc_nvenc -b:v 9000K output.mp4
example 1.14G -> 330M.
If -b:v is small, the size will be smaller. (example -b:v 5000K)
The encoding speed is fast.
NVIDIA GPU is required.

-crf

ffmpeg -i input.mp4 -crf 15 output.mp4
example 1.14G -> 441M.
-crf is 0-51. The larger the number, the smaller the size. (example -crf 25)

H.265(-c:v libx265)

I haven't tried it.

AV1(-c:v libaom-av1)

I haven't tried it.
It may take too much time to encode and may not be practical.


vr180g.com