Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFmpeg - Convert MP4 to Webm very slow

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 ?

like image 343
Luzwitz Avatar asked Apr 25 '17 13:04

Luzwitz


People also ask

Why is FFmpeg so slow?

If your CPU usage is still low after FFmpeg has managed to seek to the defined point in the video, it's likely due to one or more of the filters you're using. Some filters may not be able to use all the available CPU threads, and some filters aren't even multi-threaded.

How do I increase my conversion speed in FFmpeg?

Use the -speed number (e.g. 8), not the -preset setting (e.g. ultrafast ). The latter is for x264/x265 encoding. A Higher number means faster encoding, so ultrafast would map to 8 or so.

Can you convert MP4 to WebM?

If you need to turn your files from . mp4 to . webm, all you need is an appropriate piece of software – like Movavi Video Converter. This is the best MP4-to-WebM converter for Mac.

Which quality is better MP4 or WebM?

WebM vs MP4: File Size and Quality But since WebM is specially designed for Internet, the compression ratio of WebM is generally higher than MP4 in theory, which leads to more original quality loss than MP4. And the file size of WebM is a little bit smaller than MP4.


1 Answers

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.

like image 130
llogan Avatar answered Oct 07 '22 00:10

llogan