

Turns out, you can also compress using the libx264 argument. The number after -crf can range from 18 to 24, so there’s room for experimentation there.įor my purposes, I uploaded a compressed video through the WordPress admin, but the video on the front end wasn’t loading. This command sets the constant rate factor and also lowers the overall bitrate. Here’s what I use:įfmpeg -i input.mp4 -vcodec libx265 -crf 20 output.mp4 All you need to do is cd into the directory that contains the video, then run the command you need to compress. Here’s the fun part: seeing the real magic of ffmpeg. You can likely do this with any other unplayable media type, just modify the arguments. There’s also a shorthand code: ffmpeg -i input.m4v -c copy output.mp4. This takes input.mv4(the file you want to convert) and turns it into output.mp4(the name of the new returned file).


From there, it should be easy to compress.įfmpeg -i input.m4v -vcodec copy -acodec copy output.mp4 I’ll show an example to convert a mv4 file into mp4. Luckily, converting this with ffmpeg is a breeze. Sometimes, video formats can be “locked” to something like mv4, which makes it hard to do anything with the data. Making sure you have the right formatįirst things first, to compress a video file, it needs to be in a common format such as mp4. If you’re on another distro besides Ubuntu/Debian, just type in the equivalent for your package manager. Otherwise, it should be as simple as running sudo apt install ffmpeg. If you’re on a modern Linux distro, it’s most likely already on your system. Once you learn how to use it, it really starts to come in handy. Want to compress a file as much as possible? ffmpeg for sure. Want to convert a video file between two formats? ffmpeg. In short: ffmpeg is a library that will take care of all your multimedia needs. In this article, I hope to shine light on an alternative that comes with many Linux systems out of the box, is free, and quick to use and learn.

