![](/img/trans.png)
[英]Is it possible to rotate the frame while decoding a video with ffmpeg c++ api based on the metadata info?
[英]Metadata is not showing ffmpeg C++
我将h264编码的视频数据和PCM g711编码的音频数据混合到.mov
媒体容器中。 我正在尝试在标头上写元数据,但是当我在Windows上以及在Ubuntu中同样转到文件->右键单击->属性->详细信息时,元数据未显示。 这是我的代码-
// Instead of creating new AVDictionary object, I also tried following way
// stated here: http://stackoverflow.com/questions/17024192/how-to-set-header-metadata-to-encoded-video
// but no luck
AVDictionary* pMetaData = m_pFormatCtx->metadata;
av_dict_set(&pMetaData, "title", "Cloud Recording", 0);
av_dict_set(&pMetaData, "artist", "Foobar", 0);
av_dict_set(&pMetaData, "copyright", "Foobar", 0);
av_dict_set(&pMetaData, "filename", m_sFilename.c_str(), 0);
time_t now = time(0);
struct tm tStruct = *localtime(&now);
char date[100];
strftime(date, sizeof(date), "%c", &tStruct); // i.e. Thu Aug 23 14:55:02 2001
av_dict_set(&pMetaData, "date", date, 0);
av_dict_set(&pMetaData, "creation_time", date, 0);
av_dict_set(&pMetaData, "comment", "This video has been created using Eyeball MSDK", 0);
// ....................
// .................
/* write the stream header, if any */
int ret = avformat_write_header(m_pFormatCtx, &pMetaData);
我还尝试在Linux中使用mediainfo
和exiftools
来查看文件是否包含任何元数据。 我也尝试了ffmpeg -i output.mov
但是没有显示元数据。
有什么问题? av_dict_set
的flags
值是否为0
? 我是否需要为不同的平台(Windows / Linux)设置不同的标志?
我看到了此链接 ,并指出对于Windows,必须使用id3v2_version 3
和-write_id3v1 1
才能使元数据正常工作。 如果是这样,如何在C ++中做到这一点?
我有一些与您的代码相似的东西,但是我将AVDictionary
添加到了我的AVFormatContext
元数据参数中,并且它对我AVFormatContext
。 这是根据您的代码片段。
AVDictionary *pMetaData = NULL;
av_dict_set(&pMetaData, "title", "Cloud Recording", 0);
m_pFormatCtx->metadata = pMetaData;
avformat_write_header(m_pFormatCtx, NULL);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.