R2-D2 R2-D2 - 1 year ago 175
C++ Question

"opaque" pointer in ffmpeg AVFrame


there is a structure AVFrame describing decoded video or audio data.

It has a void pointer
. 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?

Answer Source

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)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download