Ubuntu – Multi-Core Encoding with VP9 FFmpeg

ffmpegvideo

I want to start using the WebM format and the VP9 codec for my YouTube videos. I know that with good compression comes slow speed, but FFmpeg only uses 1 of my 8 cores. I've tried using -threads 8 in my command, but FFmpeg seems to ignore it. From what I've read, the VP9 encoder should support multiple threads. What can I do to get this to work?

FFmpeg version 2.7.2-1build1
libvpx1 version 1.3.0-3ubuntu1
libvpx2 version 1.4.0-4

Command used:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 10 -b:v 5000k -c:a libvorbis output.webm

While we're at it, do I need both libvpx packages installed? libvpx2 has the Ubuntu icon next to it in Synaptic, so I'm guessing the other one is a leftover from upgrading to 15.10?

Best Answer

Thanks for the info about order of options @bodhi.zazen and @LordNeckbeard. Apparently the libvpx encoder is a little more picky about that. When I added -threads option after -c:v libvpx, it visibly uses more cores according to top.

-threads 0 only uses 1 core, -threads 8 uses 2 cores, and -threads 16 uses 4 cores. I've tried using a higher number, but the encoder says more than 16 threads is not recommended, and doesn't use any more CPU. Encoding speed itself is about twice as fast now. Thanks again for the help!