我正在将一些图像编码为mp4容器中的h264视频。我实际上使用的是ffmpeg示例muxing.c。问题是我正在尝试在mp4容器中设置一些元数据,比如艺术家、标题等。
我以为使用下面的代码会行得通,但它不是:
AVDictionary *opts = NULL;
av_dict_set(&opts, "title", "Super Lucky Dude", 0);
av_dict_set(&opts, "author", "Jacky Chan", 0);
av_dict_set(&opts, "album", "Chinese Movie", 0);
av_dict_set(&opts, "year", "05/10/2013", 0);
av_dict_set(&opts, "comment", "This video was created using example app.", 0);
av_dict_set(&opts, "genre", "Action", 0);
// Write the stream header, if any.
ret = avformat_write_header(oc, &opts);创建整个视频后,我没有看到任何元数据写入到视频文件中。有什么建议如何正确地做到这一点吗?
发布于 2013-06-11 18:30:08
解决方案是实际使用AVFormatContext中的metadata变量,而不是创建我自己的AVDictionary并将其传递给avformat_write_header function。
https://stackoverflow.com/questions/17024192
复制相似问题