Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

H.264 UMC encoder first frame low quality

buttered_monkey
Beginner
354 Views
Hi
I'm wondering why the first frame of my H264 encoded stream is much lower quality than any of the others.
I am encoding using the UMC::H264VideoEncoder and have set my params thus:
encoderParams.key_frame_controls.method = 1;
encoderParams.key_frame_controls.interval = 25;
encoderParams.key_frame_controls.idr_interval = 2;
So that each I frame is every 25 frames and all I frames are IDR frames (2 = every 1 I frame is an IDR. I am not sure what the value 1 does for the key_frame_controls.idr_interval...? But setting it to that seems to make no difference).
Any of the other I frames are of much larger size and look much less blocky.
Any ideas? It means that when you first see the stream the quality looks much worse than it is.
Thanks
0 Kudos
3 Replies
Tamer_Assad
Innovator
354 Views
Hi,

Encoded I frame has larger size than B frames, you may try some of the following, hopfully it will make your problem clearer and get solved :

1) increase the bitrate
2) decrease the resolution (frame size)
3) you may also try MPEG4 encoder if you are in doupt

Regards,
Tamer Assad
0 Kudos
buttered_monkey
Beginner
354 Views
Hi Tamer
Thanks for your help, but what I'm saying is that I have it set so that every 25th frame is an I frame and I have it set so that every I frame is an IDR.
However, my first frame is very blocky. The next I frame - 25 frames on - quality is fine and so are the rest of the I frames.
This happens even if I increase the bitrate.
This is for a product producing H.264 versions of HD film camera footage and needs to be at full rate (1920x1080) and must be H.264 not MPEG.4. If I don't get any further answers I'll check at lower res and with MPEG4 maybe but I'm hoping someone will know the answer to this with out me having to do that...?
Thanks again.
0 Kudos
Emmanuel_W_
New Contributor I
354 Views

Hi,

The quantization value for the first frame is calculated in the H264_AVBR_GetInitQP functions in umc_h264_avbr.cpp.
Not knowing anything about the actual sequence to be encoded the quantization parameter choosenis rather conservative to avoid generating huge frames.

Future IDR generated will benefit from statistics of the stream. Also the rate control algorithm ensure that there is not too much difference in term of quality between the successive frame by caping the difference of quantization value between two frames.

You might be able to tweak the return value of H264_AVBR_GetInitQP function to get the quality you want for the first frame (the lower the q the higher the quality).

Emmanuel



0 Kudos
Reply