且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用mp4parser将元数据写入mp4文件?

更新时间:2022-02-20 22:44:25

元数据和MP4确实是一个问题.没有普遍支持的规范.但这只是问题的一部分.

metadata and MP4 is a really problem. There is no generally supported specification. But this is only one part of the problem.

  • 问题(1):何时写入元数据
  • 问题(2):要写什么

问题(1)相对容易解决:只需自行扩展DefaultMp4Builder或FragmentedMp4Builder并覆盖

Prob (1) is relatively easy to solve: Just extend the DefaultMp4Builder or the FragmentedMp4Builder on your own and override the

protected ParsableBox createUdta(Movie movie) {
    return null;
}

有一些有意义的东西.例如:

with something meaningful. E.g.:

protected ParsableBox createUdta(Movie movie) {
    UserDataBox udta = new UserDataBox();
    CopyrightBox copyrightBox = new CopyrightBox();
    copyrightBox.setCopyright("All Rights Reserved, me, myself and I, 2015");
    copyrightBox.setLanguage("eng");
    udta.addBox(copyrightBox);
    return udta;
}

有人用它来编写与Apple兼容的元数据,但是即使我的代码中有一些类,我也从未真正弄清楚什么有效,哪些无效.您可能想看看Apple的规范

some people used that to write apple compatible metadata but even though there are some classes in my code I never really figured out what works and what not. You might want to have a look into Apple's specification here

是的:我要发布一年到深夜.

And yes: I'm posting this a year to late.