Adding custom metadata to h265 frames

Hello,

I am adding custom metadata using pad probe method and gst_buffer_add_video_sei_user_data_unregistered_meta.

static GstPadProbeReturn sei_injector(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) {
       GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
       static guint64 frame_counter = 0;
        buffer = gst_buffer_make_writable(buffer);
        // Define custom SEI user data (must be 16 bytes UUID + payload)
        guint8 uuid[16] = {0xAA, 0xFF};
        guint8 sei_payload[] = "AccelX=25,AccelY=87,AccelZ=2";
  	
	// Create some SEI data (for example, a string)
	gsize sei_size = strlen (sei_payload);

  	// Add the SEI data to the buffer as metadata
  	GstVideoSEIUserDataUnregisteredMeta* ret = gst_buffer_add_video_sei_user_data_unregistered_meta(buffer, uuid, (guint8 *) sei_payload, sei_size);
	
        g_print("Injected SEI metadata into frame %lu\n", frame_counter++);

	GstVideoSEIUserDataUnregisteredMeta *umetadata = gst_buffer_get_video_sei_user_data_unregistered_meta(buffer);
	
	g_assert(umetadata != NULL);
        g_print("Extracted SEI metadata from frame : %s\n", umetadata->data);

    return GST_PAD_PROBE_OK;
}

Can anyone please tell me that the above code is properly adding the custom metadata and if right then how to verify that the metadata is added?

Thanks & regards
Ravi Gohel

Hello, I am waiting for the response. Please help me out on the issue.

Thanks
Ravi