Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

How to reduce cpu usage when H264 sw encoding

huang__guan-lin
Beginner
2,341 Views

Hello support team,

I try to use H264 "sw" encode two 1080P bitstream at the same time. The cpu usage is up to 100%.
I have tried setting async =2. Encode one bitstream can reduce to 40% usage, but two bitstream is up to 100%.

Is there any other way to reduce cpu usage?

Product version: 2018 R2

Platform : Windows10 I7-8700 3.2GHZ UHD 630: 24.20.100.6287

Sample encode cmd: sample_encode.exe h264 -i input.yuv -o output.264 -sw -w 1920 -h 1080 -f 60 -b 8200 -cbr -g 120 -r 2 -async 2

0 Kudos
1 Solution
Mark_L_Intel1
Moderator
2,341 Views

Yes, let me know what's the bottleneck vTune shows.

In general, async depth sets the queue size when the sync operation occurs during hardware mode, so set it to 1 can make the CPU doing more sync operation.

For software mode, it should behavior the same, you might try to increase sync depth and see.

Again I am not quite confident if we could improve too much in the software mode since the library should be optimized already and only for backup usage when HW mode is not available.

Mark

View solution in original post

0 Kudos
3 Replies
Mark_L_Intel1
Moderator
2,341 Views

Hi Guan-lin,

Since you are using software codec, the optimization method is the same as the way we resolve a general software based on CPU. So you can use vTune to find the bottleneck and find a way to tune it. Otherwise, you could limited the input bandwidth by set async depth to 1.

 

Although you miss the whole point of Media SDK, it uses hardware acceleration on GPU to free the CPU usages. Software codec is the fallback mode of the hardware codec, so we normally don't recommend to use it independently.

 

If you are decoding HEVC, we have a GACC path which uses general GPU execution unit and might offload but we don't have this path for H.264.

 

What is your application and on which OS?

Mark

0 Kudos
huang__guan-lin
Beginner
2,341 Views

Hi Mark,

Thanks for your reply. 

I develop application for multi-video recording on Win10 and decide to use SW or HW depending on different situation.

I intend to use Intel SW to replace my current SW record solution.

I have set async depth to 1, but the CPU usage is more than set async depth to 2.

I will try to use vTune to tune it. 

0 Kudos
Mark_L_Intel1
Moderator
2,342 Views

Yes, let me know what's the bottleneck vTune shows.

In general, async depth sets the queue size when the sync operation occurs during hardware mode, so set it to 1 can make the CPU doing more sync operation.

For software mode, it should behavior the same, you might try to increase sync depth and see.

Again I am not quite confident if we could improve too much in the software mode since the library should be optimized already and only for backup usage when HW mode is not available.

Mark

0 Kudos
Reply