MFXVideoDECODE_GetPayload question

MFXVideoDECODE_GetPayload question


     I am trying to extract Closed Caption data from SEI message in AVC stream. Hence i used the sample code (simple_decode project), in which i added following snippet after mfxDEC.DecodeFrameAsync to check on SEI data.


            dec_payload.NumBit = 100;
            while(dec_payload.NumBit !=0){
            mfxStatus mfx_param_flag = mfxDEC.GetPayload(&ts,&dec_payload);
            if((mfx_param_flag == MFX_ERR_NONE) && (dec_payload.Type == 4))
            dec_payload.Type =0;


Where added variables are :

    mfxPayload dec_payload;
    mfxU64 ts;
    dec_payload.Data = new mfxU8[1024];
    dec_payload.BufSize =1024;



        When i check on dec_payload.Data memory by breaking at printf(""); i see different data than that was expected. I am not really sure if there is format issue here.
Although i am getting ATSC Identifier and Country code ,Provider code and user identifier properly such 0xB5, 0x0031, "GA94"  etc. But once CC data starts after 0xFF,   thats when i see different data . So in a way i am getting starting 12 bytes of each payload, properly. The remaining Actually CC data is mismatch from my reference . And also i am not getting Time stamp which was parameter  to this function, as it always returns 0 .


     Please let me know if i have done anything wrong or some interpretation problem. Please let me know.


I am attaching bin of dumps from my reference and from sample code with added snippet as shown for your reference.

Please HEX editors or Hex compare using Beyond compare.

CC_ref --> reference

CC_MFX--> MFX output.

                  Please suggest.





Downloadtext/plain cc_ref.txt65.09 KB
Downloadtext/plain cc_MFX.txt66.98 KB
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello Vinay,

I have added a new article on this topic, it may be of use to you.

If your code still does not work, we may have to look at how you are encoding the stream as well (assuming it is based off of a tutorial or sample code).

Regarding the timestamps - You need to set the timestamp before the DecodeFrameSync() function call in mfxBS.TimeStamp. When you do that, the GetPayload() function does return the correct timestamp in its TimeStamp variable. 

(One thing to note in simple_decode() tutorial is that we are populating only the mfxBS->Data pointer by doing an fread(). So, the TimeStamp field is going to be 0 unless you populate it with a value).

Let me know if you have more questions.


Leave a Comment

Please sign in to add a comment. Not a member? Join today