Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools from Intel. This includes Intel® oneAPI Video Processing Library and Intel® Media SDK.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2931 Discussions

BufferSizeInKB doesn't change upon call to MFXVideoENCODE_Reset with new bit rate for VBR

AaronL
Beginner
178 Views

Unexpectedly, BufferSizeInKB doesn't change when calling MFXVideoEncode_Reset() with a new bit rate for VBR (for H.264).  For example, if I configure a mfxVideoParam for 720p59.94 (w: 1280, h: 720, frame rate:  60000/1001, progressive, AVC, high profile, VBR), if I set both TargetKbps and MaxKbps to 1000 (1 Mbps), after calling Init() and then GetVideoParam(), BufferSizeInKB is set to 250 and InitialDelayInKB is set to 125.

If I instead use 4000 (4 Mbps) for TargetKbps and MaxKbps, the values of BufferSizeInKB and InitialDelayInKB are set to 500 and 1000, respectively, after calling init() and then GetVideoParam().  So, it needs a larger buffer size for 4 Mbps than for 1 Mbps, as one might expect.

However, if instead, the sequence is:

  1. Init() and GetVideoParam() with 1000 for TargetKbps and MaxKbps
  2. Reset() and GetVideoParam() with 4000 for TargetKbps and MaxKbps

BufferSizeInKB and InitialDelayInKB remain at 250 and 125, respectively.  This is even true if I reset BufferSizeInKB and InitialDelayInKB to 0 prior to calling Reset() and GetVideoParam().  This doesn't really make sense.  How can a buffer size of 250 KB be sufficient for 4 Mbps after Reset() when it isn't sufficient for the Init() sequence as described above?

This is easily reproduced by creating an instance of the encoder object, and it isn't necessary to actually encode any frames to experience this behavior.

0 Kudos
4 Replies
Jiandong_Z_Intel
Employee
178 Views

Hi There,

By default MSDK sample_encode  using CBR, Have you set m_mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_VBR for using VBR

Thanks

Zachary

 

AaronL
Beginner
178 Views

Jiandong Z. (Intel) wrote:

Hi There,

By default MSDK sample_encode  using CBR, Have you set m_mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_VBR for using VBR

Thanks

Zachary

Not once did I mention sample_encode in my post.  This has nothing to do with the sample_encode sample.  I've already described the issue in my earlier post, which includes the steps necessary to reproduce the issue.  What I described is likely indicative of a bug in the Intel Media SDK (or rather, the underlying implementation in the driver media).

If what I have already described isn't sufficient to understand the problem, I can provide source code.

Jiandong_Z_Intel
Employee
178 Views
What OS are you used ? Linux or Windows ? What product do you used ? Media Server Studio or INDE MSDK ? Which version ? If window: Please run analyzer tools and send the logs. Tools are available in (/tools/) folder. if Linux: Please send outputs of following command lines $ cat /proc/cpuinfo | grep -i intel $ lspci –nn | grep VGA if you can provide source code will be very helpful to reproduce this issue.
Sravanthi_K_Intel
178 Views

Hi Aaron, Your observation is correct - MSDK does not allow dynamic changes to HRD buffer size. This is our HW implementation (or limitation, say).To allow for bigger buffersizes when changing bitrates, you will have to allocate a bigger buffer at the initialization. It's not pretty, but thats the hw implementation today.

Reply