[FFmpeg-user] Frame-level metadata

Dzhoshkun Ismail Shakir dzhoshkun.shakir at gmail.com
Thu Mar 28 17:19:40 EET 2019

Hi All,

I'm trying to programmatically  add metadata to each frame of a video
stream. The target encoding is HEVC (via NVENC) stored in an MP4 container.
I haven't had success using any of the following (showing only relevant
code snippets for brevity):

1) AVFrame::metadata

av_dict_set(&frame->metadata, "my-custom-key", data, 0); // data: 23-char string

2) AVFrame::opaque

frame->opaque = malloc(size);

strcpy(frame->opaque, data);

3) AVFrame::opaque_ref

frame->opaque_ref = av_buffer_create(data, size,
av_buffer_default_free, NULL, 0);

Any suggestions what I'm doing wrong? Also, could anyone point me to any
examples how to do this.

Many thanks in advance,


More information about the ffmpeg-user mailing list