Table of Contents

How to reduce the size of a video dramatically with ffmpeg ?

About

This article shows you how to reduce the size of video with ffmpeg.

Size parameters

The following parameters have an important on the size:

Example

Filter

Below is a ffmpeg filter that:

crop=576:478:0:148, fps=20, scale=400:trunc(ow/a/2)*2

Codec and bitrate

The best codec nowadays is H.265 1) that is much better in term of compression without losing quality than H.264 2).

You can push the compression and minimize the bitrate further by increasing the CRF (Constant Rate Factor) value (decreasing the bitrates). A reasonable value would be between 24 and 30.

Command

After having installed ffmpeg, you can execute the below command to execute this filter pipeline::

ffmpeg.exe \
    -i input.mp4 \
    -v \
    -f "crop=576:478:0:148, fps=20, scale=400:trunc(ow/a/2)*2"  \
    -vcodec libx265 -crf 34  \
    output.mp4

where libx265 is the ffmpeg code for H.265