How to set up Media encoder mfx to have 2 B-frame

How to set up Media encoder mfx to have 2 B-frame

HiI want to have 2 B-frames from Media encoder and set GopRefDist to be 3. But the size of encoded file is same as that of GopRefDist = 1 (no B-frame). It is supposed that encoded data size with B-frame is lower than that without B-frame. Here is the code m_mfxEncParams.mfx.GopPicSize = 15; //gop length should be enough to consume bitratem_mfxEncParams.mfx.GopRefDist = 3; //Distance between I- or P- key frames (1 means no B-frames)m_mfxEncParams.AsyncDepth = 1;//internal buffering should be disabled in encode m_mfxEncParams.mfx.NumRefFrame = 1;Thanks for any advice.Jiuxiang

publicaciones de 8 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi Jiuxiang,

The way you configure GOP is correct to produce a P,B,B sequence.

The file size is not much dependent on the selected GOP structure but instead depends on the rate control and bit rate you have selected.

If you analyze the final encoded stream you will see that the B frames are significantly smaller than the P frames which is what I think you're expecting to see?

Regards,Petter

Hi Petter,Thanks for reply.1, Here is NAL type of first 21 encoded frame types: AUD, SPS, PPS, SEI, IFrame, AUD, PPS, SEI, PFrame,AUD, PPS, SEI, PFrame,AUD, PPS, SEI, PFrame,AUD, PPS, SEI, PFrame. I did not see B-Frame. BTW, is the index of B-Frame same as P-Frame?2. You are right. I changed GOP size to use more P-Frames to want to reduce the size of encoded file ( not change the bitrate). But all the kind results have the same size. P-frame has 50% of I-Frame in size. Why the encoded files have the same size even if using more P-Frame.?3. In our application, we have to use higher bitrate stream to compansate the high motion factor and high resolution, is there a way to reduce the size of encoded file (because transported by network) in Media SDK? Such as like 2 pass encoding ( I know Media SDK does not support 2 pass encoding.)Thanks.Jiuxiang

Hi Jiuxiang,

1. To verify your config I used the same set of parameters you supplied to encode, the encoded stream generated PBBP frame type order as expected.... It's following the exact same NAL sequence as you specified but b-frames are generated. I suspect your configuration is slightly different?
If you're still having issues making it work please provide Media SDK tracer log so that we can take a look at the set of parameters you use.

2. As stated earlier, the selected bit rate will dictate the size of your file. If you use frequent b-frames you may consider decreasing the bit rate. You can also explore the VBR, AVBR or QCP rate modes for greater momentary bit rate dynamics. Media SDK also support dynamic bit rate change, which may be of interest to you if you need to quickly adapt to changes in the environment. Using QCP mode you can also control QP for each frame which gives you indirect control of bitrate.

3. Media SDK does not support 2 pass encoding.

Regards,Petter

Hi Petter,Thank you very much. Your suggestion is very helpful. The traceing the log file shows the encoded file does include B-frames. Since I used CBR, so whatever changeing other setting, all the files have the same size. Once using other bitrate control, the size of encoded file reduces significantly although the bitrate is as high as before.If the size of encoded file reduced a lot, does it mean the quality of video is lower too even have the same bitrate setting? In this case, does the bitrate setting have any meanings?Thanks.Jiuxiang

Hi Jiuxiang,

there is no direct relation between bitrate and quality. The quality of the encoded output depends on many things such as profile, GOP, etc. etc.

If you want better control of quality per frame or frame type please check out the CQP rate control mode.

Regards,Petter

Hi Petter,Thank you for your helpful suggestion. I am still trying to understand the relationship between video quality and configuration of Media SDK mfxVideoParam. But I didnot know what the following members of mfxVideoParam mean: NumSlice, EncodedOrder and BufferSizeInKB.Could you tell me what acroname ofCQPis?Thanks.Jiuxiang

Hi Jiuxiang,

Please refer to the Media SDK manual and developer guide for details about the parameters.
CQP = Constant Quantization Parameters. Also referenced in manual.

Hope this helps, let us know if you have any questions.

Regards,Petter

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya