Skip to content

Instantly share code, notes, and snippets.

@laalaguer
Created August 26, 2016 10:14
Show Gist options
  • Save laalaguer/3b950bf168bd8d4801a17ba6cec473b9 to your computer and use it in GitHub Desktop.
Save laalaguer/3b950bf168bd8d4801a17ba6cec473b9 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <libavformat/avformat.h>
#include <libavutil/dict.h>
int main (int argc, char **argv)
{
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *tag = NULL;
int ret;
if (argc != 2) {
printf("usage: %s <input_file>\n"
"example program to demonstrate the use of the libavformat metadata API.\n"
"\n", argv[0]);
return 1;
}
av_register_all();
if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))
return ret;
while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
printf("%s=%s\n", tag->key, tag->value);
avformat_close_input(&fmt_ctx);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment