[Libav-user] maxhap: Set SEI unregistered user message using H264MetadataContext

Max Ashton max at halfapixel.net
Thu Jan 3 13:12:28 EET 2019


Hi Mark

On your first point any chance you can give me some pointers on setting the sei_user_data option?

This is what I have

AVBitstreamFilterContext* h264bsfc = av_bitstream_filter_init("h264_metadata");
const AVBitstreamFilter* pFilter = h264bsfc->filter;

// Guessing there is an API call to set the sie message that takes the filter?

-----Original Message-----
From: Libav-user <libav-user-bounces at ffmpeg.org> On Behalf Of Mark Thompson
Sent: 20 December 2018 20:56
To: libav-user at ffmpeg.org
Subject: Re: [Libav-user] maxhap: Set SEI unregistered user message using H264MetadataContext

On 19/12/2018 16:21, Max Ashton wrote:
> Hi all and thanks for reading!
> 
> I'm trying to set the SEI unregistered user message on a per video frame basis. I notice that libav has a H264MetadataContext structure which contains a const char *sei_user_data field. This seems to be exactly what I'm looking for. After poking around in the ffmpeg code I notice this structure is wrapped within the private data of the AVBSFContext. My knowledge is extremely limited so at this point I'm looking for an example or explanation on how to correctly access the H264MetadataContext structure. I presume I need a bit stream filter (based on the naming), but can't find any examples of setting the H264MetadataContext.
> 
> Can anyone help me with an explanation, code snippet or point me to an example I might have missed/overlooked?
> 
> Any general advice would also be appreciated. I have checked the few similar questions on stackoverflow, they don't seem to have any solid answers or explanations though (maybe due to my lack of understanding).

You're looking at internal code inside the h264_metadata BSF.  It only supports inserting the same thing on all IRAP access units - the intended use-case is adding global metadata (such as fixing up odd bugs like the x264 4:4:4 8x8 problem).  If you only want to use it for that, then you can make an instance of the h264_metadata BSF, set the sei_user_data option on it, and pass packets through it with the external BSF API.

If you want something more, there isn't any external API to do it.  The internal CBS API does offer complete decomposition of the coded bitstream, including the SEI user data, and can be used to implement whatever you like there (indeed, the h264_metadata BSF uses it).  That would require editing the FFmpeg source, though, and there is no guarantee of API stability for internals like that.  If you want to go that way then the easiest approach is probably to hack something in to the h264_metadata BSF, though making another BSF or just adding new external API calls are equally possible.

- Mark
_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email libav-user-request at ffmpeg.org with subject "unsubscribe".


More information about the Libav-user mailing list