If you need to compress one or several videos, here you can find some command line and graphical tools.

Table of Contents

FFmpeg (CLI)

The most popular video editing tool. Compressing options depends on the video format and codec (I will use a standard MP4 video with H264 encoding for the following commands).

  • Compress a video (by changing video codec preset and/or Constant Rate Factor)
      ffmpeg -i input.mp4 -c:v libx264 -preset <preset> -crf <crf calue> output.mp4
    • <preset>: has several possible values (depends on the codec). For H264, available values are: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow. Faster encoding means less CPU load and bigger filesize.
    • <crf value>: “Constant Rate Factor”. A lower value generally leads to higher quality, and a subjectively sane range is 17–28 (23 is the default).
    • More info about H264 encoding: https://trac.ffmpeg.org/wiki/Encode/H.264
  • Compress several videos (using a Bash loop and changing the filename and/or output directory)
      for i in *.mp4;do ffmpeg -i $i -preset <preset> ${i/.mp4/_new.mp4};done
      for i in *.mp4;do ffmpeg -i $i -preset <preset> output/$i;done

Avidemux (GUI)

This graphical tool can save video file in many formats and codecs, with the option to change every aspect of the encoding. After opening a file, select a video codec (usually Mpeg4 AVC x264) and select Configure. Then, select an encoding and a Constant Rate Factor (more info on the previous section).


If you have any suggestion, feel free to contact me via social media or email.