Search code examples
javamp4mp4parser

How to get avcC atom from an iTunes video using Mp4parser


Is there a way to access the avcC atom when reading a file that originated from iTunes with the mp4parser library for java? I've done this manually using the pasp atom in some custom code, but after switching to this library I lost access to the data.

Known paths for the avcC atom:

  • /moov/trak/mdia/minf/stbl/stsd/avc1/avcC
  • /moov/trak/mdia/minf/stbl/stsd/avc1/pasp/avcC
  • /moov/trak/mdia/minf/stbl/stsd/drmi/avcC

MP4Parser https://github.com/sannies/mp4parser


Solution

  • The avcC atom of a valid quicktime file can never be inside the pasp atom. The avcC atom can be next to the pasp, but it cannot be IN the pasp as the pasp box doesn't contain other boxes. You can use the Path class for easy access (it knows some regexp):

    public static void main(String[] args) throws IOException {
        IsoFile isoFile = new IsoFile("video.mp4");
        AvcConfigurationBox avcC = Path.getPath(isoFile, "/moov/trak/mdia/minf/stbl/stsd/.../avcC");
    }
    

    of all AVC configuration boxes regardless their parent box.