MP4 container writer in Java

2019-03-15 06:41发布

问题:

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. Bonus for such a library that also can write "valid" F4V.
I would prefer a pure Java solution rather than something using JNI or external executables.

回答1:

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.



回答2:

You can have a look at JCodec ( http://jcodec.org ). It contains an MP4 library and MP4 demuxer and muxer.



回答3:

May be you are looking for something like StreamBaby.



回答4:

Can't vouch for it, but red5 is an open source flash server written in Java, which claims support for streaming mp4 and has implementations of mp4 IO objects which may be able to create said format.

Also, IBM created their Toolkit For MPEG-4 a while back and though it's not free, it might help.



回答5:

FFMPEG's java bindings? http://fobs.sourceforge.net/f4jmf_first.html

Or simpler a JNA proxy over some C++ MP4 library.



回答6:

I have implemented a QuickTimeWriter class which can write a QuickTime container in pure Java.

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.

So, with an MPEG-4 spec on your lap, and a few hours of work, you should be good.



回答7:

The Java I've seen which modifies MP4 files would invoke Nero AAC Codec externally (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.



标签: java mp4 h.264