如何标题元设置为en codeD的视频? [英] How to set header metadata to encoded video?

查看:134
本文介绍了如何标题元设置为en codeD的视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一些编码图像到MP4容器内的H264视频。我基本上是使用FFmpeg的例子muxing.c。事情是我想设置在MP4容器的一些元数据,如艺术家,标题等...

I'm encoding some images into an h264 video inside an mp4 container. I'm essentially using the ffmpeg example muxing.c. The thing is I'm trying to set some metadata in the mp4 container such as artist, title, etc...

我想用下面的工作,但事实并非如此:

I thought using the following would work but it didn't:

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);

整个视频中创建

在我看不到写入视频文件的任何元数据。任何指针如何真正做到这正常吗?

After the whole video is created I don't see any metadata written to the video file. Any pointers how to actually do this properly?

推荐答案

解决方案是真正从 AVFormatContext 变量C $ C>,而不是创建我自己的 AVDictionary ,并把它传递给 avformat_write_header功能

The solution was to actually use the metadata variable from AVFormatContext instead of creating my own AVDictionary and passing it to the avformat_write_header function.

这篇关于如何标题元设置为en codeD的视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆