To compress large video files prior to uploading them to your web server you will need to install FFMPEG on your Linux box.
- Start by updating the packages list:
sudo apt update
- Install the FFmpeg package by running the following command:
sudo apt install ffmpeg
. - Validate the installation by running the
ffmpeg -version
command which will print the FFmpeg version: ffmpeg -version.
Now you are ready to compress or convert video files.
Sudo ffmpeg -i input.mov -vcodec libx265 -crf 24 output.mp4
libx265 has high compression ratio with excellent resolution/quality, however, you might run through unsupported browser players. A 485 MB MOV video, it converted the video to MP4 and compressed it down to 7 MB.
If bandwidth is not a constrain, you can use an older codec libx264, which produces almost the same quality but larger file. On the same 485 MB MOV video, it converted the video to MP4 and compressed it down to 12 MB.