[FFmpeg-user] Metadata per frame

Dennis Jansky dennis_jansky at yahoo.com
Fri Jan 24 19:21:43 CET 2014


I am trying to add some metadata on a per-frame basis that will be sent to the client.  To do so, I have done the following:

To set the metadata:

AVDictionary *dict = NULL;

int ret = -1;
if ( (ret = av_dict_set(&dict, "extra_stuff", "some value") < 0 ) {
    cout << "ERROR: Failed to set metadata" << endl;
}

av_frame_set_metadata(avFrame, dict);

avcodec_encode_video(codec_ctx, frameBuffer, frameBufferSize, avFrame)


To get the metadata:

AVDictionary *dict = NULL;
AVDictionaryEntry *entry = NULL;

dict = av_frame_get_metadata(avFrame);

if ( dict != NULL ) {
    if ( (entry = av_dict_get(dict, "extra_stuff", entry, AV_DICT_IGNORE_SUFFIX) ) {
        cout << "Metadata received " << entry->key << ":" << entry->value << std::endl;
    }

}

I am able to the set the value on a per-frame basis but, when I try to get it on the client-side; It is NULL
Any ideas ?

Thanks for any help that can be provided
Dennis


More information about the ffmpeg-user mailing list