DEV Community

Using ffmpeg to compress, convert, and resize videos

Benjamin Black on March 29, 2019

My posts are usually notes and reference materials for myself, which I publish here with the hope that others might find them useful. Given a sour...
Collapse
 
thetwopct profile image
James Hunt

Hey thanks for this, I'm trying to convert a video for web, but I think FFmpeg has changed the way it installs, so now libvpx-vp9 library is never installed, so I cannot seem to make webM videos. Any advice? Thanks!

Collapse
 
benjaminblack profile image
Benjamin Black

Depending on your platform, additional codecs may be provided in separate packages.

Collapse
 
aquaductape profile image
Caleb Taylor • Edited

I'm a total noob at this but it seems like compressing a silent video to mp4 via libx264 seems better if you want smaller file size. The quality seems just as good compared to Webm. Sometimes compressing small mp4 files with WebM increases the file size, while using libx264 on the same file compresses it correctly.

link to original-file.mp4

original-file.mp4 = 1.6MB
output-file.webm = 966 kB
output-file.mp4 = 538 kB

The ffmpeg args I used are from this post

 ffmpeg -i input.mp4 -vcodec libx264 -crf 28 output.mp4
Enter fullscreen mode Exit fullscreen mode

If I'm right, what's the fuss about WebM? Currently libx264 seems to do a better job. Is WebM on track to become much better at compression in the future?