[Libav-user] Recommended thread count to record video from rendering software

Andrey Utkin andrey.krieger.utkin at gmail.com
Tue Feb 28 11:08:36 CET 2012


2012/2/28 John Dexter <jdxsolutions at gmail.com>:
> I have a single-thread application which does 3D rendering; it is a
> moderate-heavy user of the single core it uses (~50%). In my quick
> tests, recording the rendered output to video using libav is fastest
> when I use AVCodecContext::thread_count == 3 on my quad-core PC, but
> it's almost identical with it set to 0.
>
> As well as any general advice you can offer, a couple of specific questions...
>
> 1)What does setting AVCodecContext::thread_count = 0 do (on Windows
> x86/64 hardware if it is platform-dependent)? Does it default to
> num-cores or nothing that simple?

If num of cores is 1, then 1.
If >1, then num of cores + 1, but not more than 16.
(from libavcodec/pthread.c:thread_init())

> 2)In a situation similar to mine with a single-thread app using most
> of one core on a N-core CPU, what would you set
> AVCodecContext::thread_count to, and why?

I'd use 0, if i am sure that only one instance of my app is launched.
Otherwise, i'd stay with 1 to avoid overloading CPU and host going
slowly responsive.

-- 
Andrey Utkin


More information about the Libav-user mailing list