![](/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.