I'm using the mp4parser library to add iTunes compatible meta-information to some MP4 files. This example is simplified, because it does not check if boxes are available, but reproduces the issue.
FileChannel fcr = new RandomAccessFile(srcFile, "r").getChannel();
FileChannel fcw = new RandomAccessFile(dstFile, "rw").getChannel();
IsoFile isoFile = new IsoFile(fcr);
MovieBox moov = isoFile.getBoxes(MovieBox.class).get(0);
UserDataBox udta = moov.getBoxes(UserDataBox.class).get(0);
MetaBox meta = udta.getBoxes(MetaBox.class).get(0);
AppleItemListBox apple = meta.getBoxes(AppleItemListBox.class).get(0);
AppleShowBox box = box = new AppleShowBox();
box.setValue("Series-Name");
apple.addBox(box);
isoFile.getBox(fcw);
fcw.force(true);fcw.close();
fcr.close();
The good news are that the file can be imported to iTunes and the Series-Name is shown at the correct place. But, the MP4 file is broken and it's not possible start the movie. How can I add this kind of meta-information without corrupting the file?