[FFmpeg-user] libvpx-vp9 not using all 4 real cores (no HT CPU) like libx264 does (in top: ~250% vs ~387%)

D dcmhoybdpzkh at web.de
Thu Nov 26 15:14:16 CET 2015

On 26.11.2015 11:54, Tom Evans wrote:
> On Wed, Nov 25, 2015 at 2:47 PM, D <dcmhoybdpzkh at web.de> wrote:
>> Continuing and splitting up the problem which I have here:
>> https://ffmpeg.org/pipermail/ffmpeg-user/2015-November/029274.html.
>> The problem is that libx264 utilizes all 4 cores almost to the 400% ($ top),
>> as it should be, but when using libvpx-vp9, it's only ~250%.
>> $ cd ffmpeg-git-20151124-64bit-static
>> No Problem:
>> Almost 100% on all 4 cores if I use:
>> $ ./ffmpeg -i a.mp4 -c:v libx264 -crf 23 -c:a libvorbis b.mp4
>> Problem:
>> Only 1 core used, not all 4 cores like with libx264, but also on 100% if I
>> use:
>> $ ./ffmpeg -i a.mp4 -c:v libvpx-vp9 -crf 23 -c:a libvorbis b.webm
>> Problem:
>> And trying to use all 4 cores, although all 4 cores are used now, it's only
>> on ~60-75% utilization (~250% in top):
>> $ ./ffmpeg -i a.mp4 -c:v libvpx-vp9 -crf 23 -cpu-used 4 -threads 4 -c:a
>> libvorbis b.webm
>> (changing  -cpu-used  and  -threads  higher than 4 values was neither faster
>> nor slower).
>> What do you think? (See already mentioned suggestions in 029274.html thread.
>> They unfortunately didn't help.)
>> John, the maintainer of the "Linux Static Builds"
>> (https://ffmpeg.org/download.html), says it might be due to libvpx-vp9 not
>> being optimized yet and maybe someone else has an idea.
>> Can anyone try these libvpx-vp9 commands and say how many % in $ top are
>> used?
>> My OS is Ubuntu 15.04 but I don't think this is the reason. My CPU has no HT
>> support, only 4 real cores (84W TDP Haswell).
> Do you get the same results using vpxenc and the appropriate flags?
I wasn't sure whether you mean ./ffmpeg ... -c:v libvpx ... (not 
libvpx-vp9) so I first tried this out and it defaults to libvpx-vp9.
Or whether you mean trying libvpc on its own, so I did this too:
$ git clone https://chromium.googlesource.com/webm/libvpx
$ cd libvpx
$ git checkout v1.5.0
$ sudo apt-get build-dep libvpx-dev
$ make
I don't know what the equal or similar $ vpxenc command to the ones I 
use with ffmpeg is, but I tried this:
/libvpx$ time ./vpxenc a.mp4 -o b.webm --codec=vp9 --good --cpu-used=2 
--threads=1..4 -h 1080 -w 1920
and I used this http://www.webmproject.org/docs/encoder-parameters/ doc.
It seems that --cpu-used is a bit similar to the -crf option. And 
--threads is the actual number of CPU-cores to be used.
So I set --cpu-used=2 (the =0 option takes way too much time to encode) 
and played with the --threads settings:
--threads=1: top: 99.8-100%; 1 CPU core utilization. No problem. Time to 
encode: real    3m12.482s
--threads=2: top: jumps between 182 and 198%. Not optimal. Time to 
encode: real    1m45.862s
--threads=3: top: jumps between 172 and 221%. Problem. Time to encode: 
real    1m43.762s
--threads=4: top: jumps between 342 and 359%. Not optimal but much 
better than ffmpeg (different settings though). Time to encode: real    
Don't know why --threads=3 is the basically the same as --threads=2 and 
why --threads=4 is so much faster and faster than ffmpeg, could be 
because the settings are different? First I think the same settings for 
both ffmpeg and vpxenc should be figured out, then the test can be 
repeated. Don't know what is going on here. Is ffmpeg just a wrapper for 
libenc (or libvpx in general)? Why is ffmpeg so slow with libvpx? Can 
anyone test this or does know what is going on here?
> Cheers
> Tom
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list