元数据不显示ffmpeg c++
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
元数据参数,它为我工作的方式。以下是基于您的代码的代码片段:
AVDictionary *pMetaData = NULL;
av_dict_set(&pMetaData, "title", "Cloud Recording", 0);
m_pFormatCtx->metadata = pMetaData;
avformat_write_header(m_pFormatCtx, NULL);
相关文章:
- FFmpeg:制作一个应用程序比直接使用ffmepg更好吗
- 使用FFMPEG将RGB图像序列保存到.mp4时出现问题
- FFMPEG配置文件级别id大小无效
- FFMpeg库:如何在音频文件中精确查找
- OpenCV RTP-Stream with FFMPEG
- FFmpeg——使用硬件加速进行视频解码
- 如何在 C/C++ 中使用 ffmpeg 的黑框 avfilter
- 在 GLFW 窗口中显示 FFMPEG 解码帧
- FFMPEG:sws_scale返回错误:切片参数 0, 2160 无效
- 为什么有些延迟加载 DLL 会立即使用 FFMPEG 卸载?
- 将FFMpeg AVFrame对象从C++应用程序流式传输到Python的最佳方法?
- 面临分段故障 使用 ffmpeg 读取视频时,因为"pFormatCtx-> streams [i]-> codecpar"的地址0x00
- 将 FFMPEG 帧写入 png/jpeg 文件
- FFMPEG,C++,内存泄漏,我做错了什么?
- 如何在 c++ 中使用 ffmpeg 获取 DirectShow 设备列表?
- 矛盾的未解决的外部符号+未使用的库与VS2017和FFMPEG 4
- FFmpeg av_read_frame从音频流返回数据包
- 使用ffmpeg时如何提高图像导出/提取速度?
- FFmpeg原始视频大小参数
- 用FFMPEG读取每帧时间码