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!
-deadline
and-cpu-used
to control speed. See VP8 / VP9 encoding with FFmpeg: relation between -speed and -deadline options-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!