In ffmpeg
there is a structure AVFrame describing decoded video or audio data.
It has a void pointer opaque
. The documentation claims it is "for some private data of the user".
What does this mean? Can it be used to transport any additional data as per-frame metadata?
It is a field dedicated for user (as opposed to ffmpeg libraries) usage; ffmpeg will not touch this field in any way so you are free to use it as you see fit. There is a caveat though: some ffmpeg functions will make a copy of AVFrame (or maybe move reference from AVFrame to another), which includes copying this field's value. It might be somehow tricky to manage lifetime of a data pointed to by this field.
If you just need to handle some per-frame metadata, you might want to consider existing metadata storage available in AVFrame (see av_frame_get_metadata/av_frame_set_metadata
)