How to use ffmpeg to compress avi and mp4 files

I've written an article about some tricks you can do with ffmpeg, in today's article, I will show you another trick - compressing avi and mp4 video files with a simple command with a only a small loss in video quality.

use ffmpeg to compress avi and mp4 files

If you dont have ffmpeg already installed, you can run this command to install it in Ubuntu and other Debian-based distros:
sudo apt-get install libav-tools

To compress an avi video file using ffmpeg, the command you can use is:

ffmpeg -i input.avi -vcodec msmpeg4v2 output.avi

To compress an mp4 video file using ffmpeg, the command will be somewhat different:
ffmpeg -i input.pm4 -acodec mp2 output.mp4

In both commands, replace the input filenames with a specific file, after the compressing process is done, you will have an output file in the same folder.
linux tips and tricks