Community
cancel
Showing results for 
Search instead for 
Did you mean: 
song_l_
Beginner
49 Views

Output Size of H264 encode is strange

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
49 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
49 Views

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

   

Reply