Problems with insertion of SEI messages (H.264) into the bitstream

Problems with insertion of SEI messages (H.264) into the bitstream


I try to insert SEI messages (H.264) into the bitstream. I open the output encoded stream with Tektronix MTS4EA Video ES Analyser. But it reports error: End of NAL unit reached while reading RESERVED_SEI_MESSAGE_PAYLOAD_BYTE. I attached screenshot. Below I wrote an example of code as I insert SEI messages. What do I do incorrectly?

mfxSession mfx_session;
mfxVersion version = {0, 1};
mfxVideoParam mfx_enc_params;
mfxFrameSurface1 pSurface;
mfxSyncPoint EncSyncP;
mfxBitstream mfxBS;

MFXInit(impl, &version, &mfx_session);

// filling of mfx_enc_params structure
mfx_set->mfx.CodecId = MFX_CODEC_AVC;

MFXVideoENCODE_Init(mfx_session, &mfx_enc_params);

//initialization of pSurface and mfxBS

// SEI message

mfxEncodeCtrl mfxEncCtrl = {0};

unsigned char text[] = "MainConcept";

mfxPayload * p_payload[256];
mfxPayload p;

p.Data = text;
p.BufSize = sizeof(text);
p.NumBit = sizeof(text) * 8;
p.Type = 5; //user_data_unregistered

mfxEncCtrl.Payload = p_payload;
mfxEncCtrl.Payload[0] = &p;
mfxEncCtrl.NumPayload = 1;

MFXVideoENCODE_EncodeFrameAsync(mfx_session, &mfxEncCtrl, pSurface, &mfxBS, &EncSyncP);

//writing encoded data to file...


Downloadimage/png error.PNG55.46 KB
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Marina,

Please see the following forum post for how to insert SEI message into H.264 stream.

Hope this helps.

Hi Petter,

Thank you for reply. I corrected my code as in your example. Now SEI messages are inserted without problem.

Best regards,

Leave a Comment

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