Last active
May 21, 2024 13:40
-
-
Save figgis/d3cff69be815491eff1ac9338aa78add to your computer and use it in GitHub Desktop.
H264 extract SEI using FFMPEG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It's actually quite simple to extract unregistered sei data using ffmpeg, but I couln't find any documentation about how it's done | |
AVFrameSideData *sd; | |
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_SEI_UNREGISTERED); | |
if (sd) { | |
// First 15 bytes is the uuid, unregistered payload start at index 16 and the | |
// total size is given by sd->size | |
printf("side-data size %ld first-byte %u\n", sd->size, sd->data[16]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That was very helpful. It took me a fair bit of time to get it up and running though and I realised that a frame could hold multiple AV_FRAME_DATA_SEI_UNREGISTERED items. This required additional care and looping over the
frame->side_data
rather than callingav_frame_get_side_data
. The result of my exploration incorporating this in two ffmpeg examples is here: https://gist.github.com/tvercaut/94c68e46d0d0321a2c83b88024d9cd69