sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.76k stars 566 forks source link

Workaround for some apple videos removed in 2.x #267

Open frederic-giltay opened 7 years ago

frederic-giltay commented 7 years ago

I'm trying to upgrade from version 1.x to 2.x but I now have a problem when providing an Apple mov file to IsoFile. You can get the video file here : https://www.dropbox.com/s/5xhric81zo8t0mc/zero-size-mov.mov?dl=0 The problem is with the "avc1" VisualSampleEntry. The entry size is 147B. It contains the usual 78B of metadata, an avcC box of 39B and a colr box of 18B. That leaves 4B with value 00 at the end of the avc1 entry which is not part of the colr box. The parser thinks it's reading the beginning of a new box which results in a wrong error "box size of zero means 'till end of file. That is not yet supported".

The workaround you put in place on the 1.x branch is in VisualSampleEntry.java, line 190-229.

Can we have a fix for this on the master branch?

For info, this is the content of the whole avc1 entry: 00 00 00 93 61 76 63 31 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 07 80 04 38 00 48 00 00 00 48 00 00 00 00 00 00 00 01 05 48 2e 32 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 ff ff 00 00 00 27 61 76 63 43 01 42 00 29 ff e1 00 10 67 42 00 29 ab 40 3c 01 13 f2 cd 40 40 40 40 80 01 00 04 28 ce 3c 30 00 00 00 12 63 6f 6c 72 6e 63 6c 63 00 01 00 01 00 01 00 00 00 00