FFmpeg - convert MP4 to Webm very slowly

I need to 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 this is a very long time.

Faster?

+5
source share
2 answers

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

Setting it to 0 will give the best quality, but very slowly. Using 1 (default) or 2 will give additional significant increases in encoding speed, but it will begin to have a more noticeable effect on quality and may also begin to control the data rate. Setting the value to 4 or 5 will disable the "speed" distortion optimization ", which has a big impact on quality, but also significantly speeds up coding.

Alternatively, it looks like the VA-API can be used for VP8 hardware accelerated coding, but I have no experience with this.

+3
source

Using ffmpeg to convert a movie file from mp4 to webm takes time. In your case, a video is 100 MB in size, it can take a lot of time.

The best way to speed up this example is to use a more powerful machine. The effectiveness of ffmpeg is relayed to the processor power of the processor (mostly), and in your case, RAM. Use a more powerful machine, get faster conversions.

Having said that, if you want a faster conversion, but you do not mind losing quality, you can use ffmpeg presets , like ultrafast :

 ffmpeg -i input.mp4 -preset ultrafast out.webm 
+1
source

Source: https://habr.com/ru/post/1267138/


All Articles