[FFmpeg-devel] [PATCH 1/3] lavc/qsv: apply AVCodecContext AVOption -threads to QSV

Linjie Fu linjie.justin.fu at gmail.com
Sat Apr 10 08:32:14 EEST 2021


Hi Haihao,

On Thu, Apr 8, 2021 at 3:10 PM Haihao Xiang <haihao.xiang at intel.com> wrote:
>
> By default the SDK creates a thread for each CPU when creating a mfx
> session for decoding / encoding, which results in CPU overhead on a
> multi CPU system. Actually creating 2 threads is a better choice for
> most cases in practice.
>
> This patch allows user to specify the number of threads created for a
> mfx session via option -threads. If the number is not specified, 2
> threads will be created by default.
>
> Note the SDK requires at least 2 threads to avoid dead locks[1]
>
> [1]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/_studio/mfx_lib/scheduler/linux/src/mfx_scheduler_core_ischeduler.cpp#L90-L93
> ---
Optional choice for users to specify the thread number looks reasonable to me,
and decreasing the CPU overhead makes sense for HW encoding pipeline.

Also curious about what's the tradeoff of decreasing the thread number to 2.
Would the performance or something else drop?

- linjie


More information about the ffmpeg-devel mailing list