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 -10.18.10.3621
I'm using the Intel Media SDK 2014 R2. I've tried using the latest API version on my system as well (1.8).
sample_encode.exe h264 -b 2000 -u speed -tff -f 29.97 -i "input.yuv" -o video.264 -w 1920 -h 1080 -hw -d3d
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.
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.