FFMPEG for web video
I wanted to convert a few videos to web compatible formats (webm and mp4). I run the recipe ffmpeg -i input.mp4 -c vp9 -b:v 0 -crf 41 output.webm
, but kept getting the error Invalid encoder type 'vp9'
even after manually building ffmpeg on my machine.
Running ffmpeg -codecs | grep vp9
revealed that I did have the right codecs installed:
DEV.L. vp9 Google VP9 (decoders: vp9 libvpx-vp9 ) (encoders: libvpx-vp9 )
Finally, I've found that there's a more robust way to specify codec: -codec:v libvpx-vp9
.
So the correct recipe would be like this:
ffmpeg -i input.mp4 -codec:v vp9 -b:v 0 -crf 41 output.webm