Media (Intel® oneAPI 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
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

Output Size of H264 encode is strange

song_l_
Beginner
176 Views

Hi,

I used one image data to compress into  a AVC video.the output buffer size is strange.

GopPicSize =1;  AsyncDepth=1;

for (int i = 0; i < 100; ++i){
    DWORD dt = GetTickCount();

    memset(&bitStream, 0, sizeof(mfxBitstream));
    bitStream.MaxLength = bufferSize;
    bitStream.Data = buffer;
    for (;;)
    {
        status = MFXVideoENCODE_EncodeFrameAsync(session, NULL, &surface, &bitStream, &syncp);
        //....some common routing.... 
    }
    MFXVideoCORE_SyncOperation(session, syncp, INFINITE);
    printf("%ld, %ld\r\n", bitStream.DataLength, GetTickCount() - dt);
}

 The output is:

49747, 15
43905, 16
38935, 0
35141, 0
29245, 0
25950, 16
23541, 0
18919, 0
16195, 0
16195, 16
16195, 0
16195, 0
16195, 0
16195, 0
16195, 16
16195, 0
16195, 0
16195, 0
16195, 0
16195, 0
16195, 0
16195, 16
16195, 0
16195, 0
16195, 0

 The problem is :

1)The output DataLength should be the same when GopPicSize =1(I Frame only).

Maybe the first frame will be a little bigger because of some header information. 

2) The encode time is not the same. if there is a cache, It should be 16, 0,0,0,0......

Is there anyone who can explain the output data?

0 Kudos
2 Replies
Jeffrey_M_Intel1
Employee
176 Views

Many things could affect frame size -- especially the input stream.  To understand expected behavior you can start with the tutorials.  The simple_3_encode tutorial is designed to be simple so you can quickly add your own modifications to GOP parameters, BRC, etc.  I suspect you will see different behavior (perhaps more like you expect?) if you switch to CQP instead of CBR/VBR.

For encode time, since the implementation is asynchronous the time/latency to encode is not expected to be constant.  The low latency tutorials can be used as a starting point/reference for tracking encode time by frame.

Regards, Jeff

 

song_l_
Beginner
176 Views

TO:Jeffrey Mcallister (Intel)
    Thanks for you answer。

   

Reply