1
我將h264編碼的視頻數據和PCM g711編碼的音頻數據混合到一個.mov
媒體容器中。我正在嘗試在頭上編寫元數據,但是當我在Windows上同時在文件 - >右鍵單擊 - >屬性 - >詳細信息時,元數據未顯示。這是我的代碼 -元數據未顯示ffmpeg C++
// 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
,但沒有顯示元數據。
最新問題?是flags
值0
在av_dict_set
好嗎?我需要爲不同的平臺(windows/linux)設置不同的標誌嗎?
我看到了this link,它指出,對於windows,我必須使用id3v2_version 3
和-write_id3v1 1
來使元數據工作。如果是這樣,我怎麼能在C++中做到這一點?
對於任何其他困惑的用戶來說,只有特定的元數據片段可以與給定的格式一起使用。例如av_dict_set(&pMetaData,「my_custom_metatype」,「my_custom_metadata」,0);可能會默默地失敗。 – Chris