FFmpeg - Convert MP4 to Webm very slow

Luzwitz picture Luzwitz · Apr 25, 2017 · Viewed 8.4k times · Source

I need convert MP4 to webm with ffmpeg. So, i use :

ffmpeg -i input.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm

But it's very long.

Is there faster ?

Answer

llogan picture llogan · Apr 26, 2017

libvpx is a relatively slow encoder. According to the VP8 Encode Parameter Guide: Encode Quality vs. Speed, you can use the -cpu-used option to increase encoding speed. A higher value results in faster encoding but lower quality:

Setting a value of 0 will give the best quality output but is extremely slow. Using 1 (default) or 2 will give further significant boosts to encode speed, but will start to have a more noticeable impact on quality and may also start to effect the accuracy of the data rate control. Setting a value of 4 or 5 will turn off "rate distortion optimisation" which has a big impact on quality, but also greatly speeds up the encoder.

Alternatively, it appears that VA-API can be utilized for hardware accelerated VP8 encoding, but I have no experience with this.