I am working on a project where a lot of videos need to be converted quickly in a fairly good quality. I decided to use ffmpeg and V8 encoding because of the licensing of the codec. h.264 isn't an option because of it's patents.

I eventually settled for this command:

ffmpeg -y -i video.avi -b:v 2M -pix_fmt yuv420p -threads 8 -cpu-used 2 -movflags +faststart -vcodec libvpx -an -r 30 temp/video.webm

This command seems to work just fine. But I have a problem. The video processing takes an insanely long amount of time. The speed usually starts at 0.300x but rapidly drops to around 0.092x.

And for your information, the video I use has 30FPS , a resolution of 720p and lasts only 9 minutes.

I tried setting the bitrate (b:v) to a lower value (even 1K!) and played around with strange complicated arguments but it didn't change anything.

It also couldn't be a CPU problem; converting to h.264 always worked fine.

I have no idea what to do now. I don't really want to change the the codec or reduce the quality. This may be the fault of the V8 encoder (but I'm wondering why reducing the bitrate didn't speed anything up).

I hope someone can give me tips on how to improve my command or at least tell me why it is so slow. Thanks in advance!

  • I have already specified the threads as suggested in the answer of the question. This also doesn't explain why lowering the bitrate doesn't change the processing time. May 18 at 15:53
  • But it does address why it is so slow.
    – Yorik
    May 18 at 16:18
  • 1
    If speed is the utmost importance then consider trying a hardware accelerated VP8 encoder such as vp8_vaapi. Otherwise, use -deadline and -cpu-used to control speed. See VP8 / VP9 encoding with FFmpeg: relation between -speed and -deadline options
    – llogan
    May 18 at 17:16
  • 1
    Okay, I tried adding -deadline realtime and it looks very promising. It boosted the speed to around 0.6x and it seems to be quite constant (it doesn't drop anymore). I will take a look at the hardware accelerated encoder (even though I'm not sure if it is supported by my hardware). Thank you! May 18 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.