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.
3075 Discussions

advice on sample_encode program tuning for fast encoding speed

yu__leon
Beginner
1,361 Views

Hi there 

I am using media SDK 1.26 and its sample_encode program to do a real-time H.264 streaming application.  I would like to ask for some general advice on how to tune the encoding parameters for fast encoding speed. 

I am encoding at 1280x720 and 1920x1080, using software encoder; the typical frame rate of my application is about 10~15 fps. 

I have selected  MFX_TARGETUSAGE_BEST_SPEED and the input format for encoder is NV12.   What other configuration parameters can I look at to improve the encoding speed?  any suggestion is much appreciated. thank you.

 

0 Kudos
5 Replies
Ramashankar
New Contributor III
1,361 Views

Hi Yu,

Some basic things to achieve fast encoding:

1. set AsyncDepth to 1.

2. Avoid B frame encoding, use h264 baseline profile. B frame can cause additional latency of 1-2 frames in encoding.

3. Provide one complete frames in input to encoder in each call.

4. Set TargetUsage to MFX_TARGETUSAGE_BEST_SPEED in encoder param.

5. Though software encoding is also suffice to produce 1 h264 stream @15 fps, but if you can exploit hardware capability then it may slightly speed up. Of course hw encoding have its own pros n cons. So need to take decision as per your working scenario.

0 Kudos
Artem_S_Intel
Employee
1,361 Views

If it is SW, the best way is to enable  multi-slice, it'll make encoder to run multiple slices in parallel.

0 Kudos
yu__leon
Beginner
1,361 Views

Ramashankar wrote:

Hi Yu,

Some basic things to achieve fast encoding:

1. set AsyncDepth to 1.

2. Avoid B frame encoding, use h264 baseline profile. B frame can cause additional latency of 1-2 frames in encoding.

3. Provide one complete frames in input to encoder in each call.

4. Set TargetUsage to MFX_TARGETUSAGE_BEST_SPEED in encoder param.

5. Though software encoding is also suffice to produce 1 h264 stream @15 fps, but if you can exploit hardware capability then it may slightly speed up. Of course hw encoding have its own pros n cons. So need to take decision as per your working scenario.

thank you

0 Kudos
yu__leon
Beginner
1,361 Views

Artem S. (Intel) wrote:

If it is SW, the best way is to enable  multi-slice, it'll make encoder to run multiple slices in parallel.

is this related to mfxInfoMFX.NumSlice setting?  or a group of parameters needs to be considered together?

0 Kudos
Mark_L_Intel1
Moderator
1,361 Views

Hi Leon,

Ramashankar and Artem has very good advices and they are all correct, just try to summarize the general guide lines:

1. Choose HW mode instead of SW, Ramashankar's suggestions are based on HW mode.

2. SW mode works as a fallback if HW mode is not available because it is slower than HW mode.

3. In HW mode, you can use graphic memory as the internal buffer to save the time of copying, especially when you have multiple component(encoder, decoder, vpp) in the pipeline, this will speed up the processing speed.

4. Different use case could have different arguments to speed up. MSDK is designed to process multiple stream at the same time, it would be more efficient to to them in parallel.

Mark

0 Kudos
Reply