Thursday 2 June 2011

MP4 Libraries in Media Manager

MediaManager 2.0 is pretty much ready to release apart from a problem with the MP4ItunesStore. This store is used to save metadata into mp4/m4v files so that they appear correctly in iTunes and can be used with AppleTV, iPad's etc....

In version 1.x this store was based around a command line application AtomicParsely. However this always anoyed me as it was not very easy to use and was slot to drive it from java.

In version 2.x I've been working towards a pure java solution. I first of starting to use jaudiotagger. I found this while working on my podcaster application. This is more about audio files than video though. It works well for podcaster, but not very well for MediaManager. I had to hack it quite a bit before it would work, then I started to find problems with parsing some MP4 files.

I stumbled across mp4parser next. This is pretty good and does everything I need or so it seemed at first. I found a number of bugs in the library. I fixed a number of these and sent patches to the project (Still not been applied :-( ), I then found a case where a DVD I had turned into a MP4 file would get corrupted.  raised a issue on this also. Not only did it courrpt the file, but it gave me no way of detecting a error. Due to these problems I had to stop using the library. The project has a hight amount of activity so I'm still hoping these things might get fixed.

I've looked around for other Java solutions, but not found any. I could possibly write my own or fork one of the others, but that's too much work for now. Instead I've started to look at using a native library called MP4v2 which is used by a number of other C/C++ projects. To create the bindings I'm using JNA. This as not been without problems though. Currently on Linux I'm seeing segfaults unless I use a 32Bit sun JVM. Strangely this happens on a 64Bit sun JVM also. I'm currently hopeing to find out why and fix the problem, but will see what happens.......... It might mean we only have iTunes support for curetain Arch/JVM's.

Anyways once these problems are solved, MediaManager will be ready for release