7

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?

3
  • Try the -threads option. -threads 0 should use all your cores. You can try -threads 8 or -threads 16 . Order of options is important, so put the -threads option before the input (-i input.mp4) option.
    – Panther
    Oct 28, 2015 at 23:45
  • Also, the command you posted has no -threads option ;)
    – Panther
    Oct 28, 2015 at 23:48
  • @bodhi.zazen Options before -i will be applied to the input (the decoder or demuxer).
    – llogan
    Oct 29, 2015 at 19:19

2 Answers 2

4

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!

0

For a server with 16 CPUs, you can try this options: -threads 16 -slices 16 -cpu-used -4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .