[Libav-user] When to set thread_count

Info || Non-Lethal Applications info at non-lethal-applications.com
Sun Dec 4 21:26:54 EET 2016


I use libavcodec as my decoding framework.
Up until now, I was using an older version of libavcodec (about 1 year old) and the performance was fine.

I then updated to the latest version and I found out that I needed to set the thread count to zero manually as libav wouldn’t use more than one core for H.264 decoding otherwise (probably for other codecs as well). It was my understanding that setting the thread count to zero would cause libav to determine the optimal thread count under the hood. When setting it to zero it would also play 4K H.264 files using the number of cores needed.

I then imported an AVID DNxHD 185 file and my machine used 600% CPU although the same file played file in VLC only using around 65% CPU on my machine. I then removed the “thread_count = 0” line from the code and it also only used around 65% of CPU but still played back the same way as when using 600% CPU. This leads me to think that something’s odd with the DNx decoder.
Has anyone else experienced that issue?

What’s the right way of setting the thread count? Should it be set to 0?
I just found out that leaving it untouched only ever uses 1 core. Higher bandwidth DNx files wouldn’t play if they needed more than 1 CPU core.

Any advice would be greatly appreciated!

Thanks in advance!


More information about the Libav-user mailing list