Java 中的 MP4 容器编写器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3663797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MP4 container writer in Java
提问by Paul Gregtheitroade
I would like to find a FREE MP4 (container) writer for Java. I do not need an encoder, only something which can write the correct atoms given their expected values. Bonusfor such a library that also can write "valid" F4V.
I would prefer a pure Java solution rather than something using JNI or external executables.
我想为 Java 找到一个免费的 MP4(容器)编写器。我不需要编码器,只需要可以编写给定预期值的正确原子的东西。对这样一个也可以编写“有效”F4V 的库的奖励。
我更喜欢纯 Java 解决方案,而不是使用 JNI 或外部可执行文件的解决方案。
采纳答案by Sebastian Annies
Even though my answer comes very late you could have a look into my MP4 Parser/Unparser at Github. You can parse MP4 files, modify them and write the result. You can even start from scratch creating boxes programatically and write your object representation to some sink.
即使我的回答来得很晚,您也可以在Github 上查看我的 MP4 Parser/Unparser 。您可以解析 MP4 文件,修改它们并写入结果。您甚至可以从头开始以编程方式创建框并将对象表示写入某个接收器。
回答by Stanislav Vitvitskyy
You can have a look at JCodec ( http://jcodec.org). It contains an MP4 library and MP4 demuxer and muxer.
您可以查看 JCodec ( http://jcodec.org)。它包含一个 MP4 库和 MP4 解复用器和复用器。
回答by Joe
May be you are looking for something like StreamBaby.
可能您正在寻找类似StreamBaby 的东西。
回答by Werner Randelshofer
I have implemented a QuickTimeWriterclass which can write a QuickTime container in pure Java.
我已经实现了一个QuickTimeWriter类,它可以用纯 Java 编写一个 QuickTime 容器。
As far as I know, the QuickTime file format is structurally equivalent to MPEG-4 Part 14. There are only a few minor differences in the fields inside atoms/boxes.
据我所知,QuickTime 文件格式在结构上等同于 MPEG-4 Part 14。在原子/盒子内部的字段中只有一些细微的差异。
So, with an MPEG-4 spec on your lap, and a few hours of work, you should be good.
因此,有了 MPEG-4 规范和几个小时的工作,你应该会很好。
回答by Chadwick
Can't vouch for it, but red5is an open source flash server written in Java, which claims support for streaming mp4 and has implementations of mp4IO objects which may be able to create said format.
不能保证它,但red5是一个用 Java 编写的开源闪存服务器,它声称支持流式 mp4 并具有可能能够创建所述格式的 mp4IO 对象的实现。
Also, IBM created their Toolkit For MPEG-4a while back and though it's not free, it might help.
此外,IBM 不久前创建了他们的Toolkit For MPEG-4,虽然它不是免费的,但它可能会有所帮助。
回答by Daniel Voina
FFMPEG's java bindings? http://fobs.sourceforge.net/f4jmf_first.html
FFMPEG 的 java 绑定? http://fobs.sourceforge.net/f4jmf_first.html
Or simpler a JNA proxy over some C++ MP4 library.
或者在某些 C++ MP4 库上使用更简单的 JNA 代理。
回答by Chadwick
The Java I've seen which modifies MP4 files would invoke Nero AAC Codecexternally (a Windows native .exe which Nero does not supply the source for) to modify AAC files (which are Apple's audio-only MP4 files). It works for audio only, not to video.
我见过的修改 MP4 文件的 Java 会在外部调用Nero AAC Codec(Nero 不提供源的 Windows 原生 .exe)来修改 AAC 文件(这是 Apple 的纯音频 MP4 文件)。它仅适用于音频,不适用于视频。