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

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

本文介绍了如何使用mp4parser将元数据写入mp4文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mp4parser来复用从原始视频文件重新编码的h264和aac文件,如何将原始视频的元数据写入新的mp4文件?还是有一种通用方法将元数据写入mp4文件?

I'm using mp4parser to mux h264 and aac file which are re-encoded from orginal video file,how can I write the metadata of the original video to the new mp4 file? Or is there a common method to write metadata to mp4 file?

推荐答案

元数据和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.

这篇关于如何使用mp4parser将元数据写入mp4文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:16