I 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 bitrate
m_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
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.)
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.
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?
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.