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.

Video Bitrate Problem

gthomaz
Beginner
931 Views
Hi guys!

I've implemented IConfigureH264Encoder class to set some H264 parameters in my app.

The most important parameter in my case is the video bitrate (for commercial reasons).
I did some tests changing the bitrate and It works.

But, I found a problem:
If I set Encoder Bitrate to less than 185 (aprox.) kbps, and then I check the Video parameters with Media Player Classic, it have 1080 kps.

I happen only if the bitrate is < 185 kps. If it is greater than 185, the final bitrate is the same as specified.

Someone has the same problem?
I don't know if it is my problem or it is a encoder bug...
Thanks!

0 Kudos
1 Solution
Eric_S_Intel
Employee
931 Views

A college of mine on the encoder team helped me with this. I think is explains the behavior. The lowest bitrate the encoder can use for 500x compression is as follows:

uncompressed_frame_size * FrameRate/500 = (Width * Height * 1.5 * FrameRate)/500

Given the bitrate has to be > 185kbs, our guess is that you have the following:

Width = 1920
Height = 1072
FrameRate = 29.97

MinTargetKbs = 1920*1072*1.5*30/500 = 185.2416 kbps.

Hope this helps
Thank you Nikolai!

-Eric

View solution in original post

0 Kudos
6 Replies
Eric_S_Intel
Employee
931 Views

Hi,

Thanks for the report, Ill look into this, but first can I get some more information from you?

- Are you using HW or SW mode?, What platform?

- If HW, what version? (\program files\Common Files\Intel\Media SDK\s1 (i1)\2.0 (1.5)\libmfxhw32/64-s1/i1.dll)

Eric

0 Kudos
gthomaz
Beginner
931 Views
Hi Eric!

I'm using SW mode (2.0.12.24071) for Windows 32 bits (XP).

0 Kudos
Eric_S_Intel
Employee
932 Views

A college of mine on the encoder team helped me with this. I think is explains the behavior. The lowest bitrate the encoder can use for 500x compression is as follows:

uncompressed_frame_size * FrameRate/500 = (Width * Height * 1.5 * FrameRate)/500

Given the bitrate has to be > 185kbs, our guess is that you have the following:

Width = 1920
Height = 1072
FrameRate = 29.97

MinTargetKbs = 1920*1072*1.5*30/500 = 185.2416 kbps.

Hope this helps
Thank you Nikolai!

-Eric

0 Kudos
gthomaz
Beginner
931 Views
Hi again Eric!

hmm.. Its makes sense..

But, I'm working with 320x240 image size.

Width = 320; Height = 240; FrameRate = 30;
So,
MinTargetKbps = 320*240*1.5*30/500 =~ 7kbps

But, in fact, when I test it here, the minTargetKbps still 185;

I try to set IConfigureH264Encoder's interface frame_width and frame_heigth parameters instead 0x0.
I don't know, but maybe the Encoder has 1920x1072 as default and you can't work with a lower bit rate than 185, it's not clear ...

It won't be a problem to me, but my sugestion is:
In Media SDK next release, this structure could return an error when you try to set an unsupported (lower) bitrate or set to the min aceptable bitrate (not to the max bitrate like nowadays).

Really thanks for your answer Eric!
0 Kudos
Eric_S_Intel
Employee
931 Views

Ok, yeah. You are right. I gave you the information for the library, but looking a bit deeper the DShow sample does a bit of padding to the range.

The bitrate you are setting in the property page is being overwritten CEndVideoFilter::CheckInputType. You can see the filter submits the submitted value and gets back the range of acceptable bitrates in GetBitRateRanges(). For 320x240 @29.97 is 150-4000 with 900 being selected as ideal.

The filter then calculates a coefficient of FrameRate/25.0 and multiplies it to the low range for some reason. I would assume this is a safety padding?. Ill find out. Finally the up-scaled value is written back to the registry, replacing the value you set.

Fortunately, its the sample thats changing your bitrate and you are free to change it.

About your feedback regarding an error returned - I believe the MSDK behavior will correct the erroneous value entered sending back a working value instead of throwing an error and letting the app developer sort it out.. its more user friendly that way.

-Eric

0 Kudos
gthomaz
Beginner
931 Views
Ok Eric!!
Thanks for your explanation again...
I'll look for these functions..
Thanks a lot!
0 Kudos
Reply