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

H.264 Encoder Bit Rate limit does not work with certain video content


I'm working on a live streaming application where the connection bitrate and video content is variable and unpredictable. 

Depending on the content (high motion content that cannot be easily compressed), the encoder uses significantly more bits than the bitrate limit.  The average bitrate limit is not met if the content is very variable and not easily compressible.

With an extreme case (video that contains a garbage signal), the encoder generates an output file that is very large (regardless of the target bitrate setting).  I've attached the "garbage" signal that I'm using for this test (GarbageSignal.mp4).

I've tried to manually set the MaxFrameSize, but this doesn't work (there appears to be a lower limit on the frame size - content dependent).  Both the VBR and CBR rate control methods suffer from the same problem.  I've also tried the CQP mode, but the maximum QP value can only be set to 51 (H.264 spec).  This value still results in large frames (again content dependent).  I've also set the BitRateLimit to OFF, but this doesn't seem to effect the encoded size (with certain content).

For this application, I need to guarantee that the bitrate limit doesn't get exceeded regardless of the content.  I don't expect the encoded output to look great, but the encoded frame sizes need to be restricted (so that the target bitrate limit is met).  If I set the BufferSizeInKB to a very low value, the encoder doesn't generate valid data (errors in the P frames).

Is there a way to limit the bitrate regardless of the content?

This is my driver version:

Intel® HD Graphics 4600 -

I'm using the Intel Media SDK 2014 R2.  I've tried using the latest API version on my system as well (1.8).

Test Parameters:

sample_encode.exe h264 -b 2000 -u speed -tff -f 29.97 -i "input.yuv" -o video.264 -w 1920 -h 1080 -hw -d3d



0 Kudos
2 Replies

In general, our encoding is HRD compliant.

In the current implementation, the encoder tries to achieve the target bitrate, but does not always obey the specified maximum (content dependent). You can contain the variation around the target bitrate by reducing the BufferSizeInKB, but it will not eliminate all the variation. 

Improvements to this implementation are coming.


0 Kudos

Thanks for looking into this.  This problem (noisy content) is actually quite common with cameras in low-light environments.  Hopefully, this issue can be addressed because we are very happy with the encoder performance.    

For what it's worth, the software x264 encoder had the same problem, and this is how they fixed it:
0 Kudos