Search code examples
videoffmpegmp4

MP4 container parsing: What is 'Alias Data Handler' for?


I have an mp4 file which I am parsing with this demuxer lib. I stumbled upon a bug when trying to identify a track type. MP4 container keeps this info in hdlr box. In the docs and in the lib there are only two options 'vide' or 'soun',but in this case I am getting 'alis'. While debugging the lib to see how I get this value I noticed that the parser hits 'hdlr' twice: first time setting 'vide' for the only video track in the file, and second time overwriting with 'alis'. I have loaded the video into MP4 Explorer GUI app and here is what I see:

enter image description here

Indeed,there is second hdlr box there,which doesn't exist in other mp4 files I tried to parse. My questions are:

  1. What is this token for?
  2. When is it inserted into mp4?
  3. Can I just discard 'alis' when encountering one during the parsing?

Solution

  • From some research...

    (1) What is this token for?

    The alis atom is for listing a file alias (or shortcut) to an external resource/URL (eg: a stored file).

    (2) When is it inserted into mp4?

    An alias atom is usually found in QuickTime MOV files (though it's not illegal to be placed inside an MP4). This "file alias" is something QuickTime player would have responded to (such as for example launching a web page URL during playback).

    This other Answer shows a link with a guidance on the data structure of this atom.

    (3) Can I just discard alis when encountering one during the (miniMP4) parsing?

    There's no other choice, the miniMP4 library does not even have code for handling alis data.
    Yes you can safely skip it. It is not mandatory for playback.

    PS:
    I wonder if your MP4 is possibly a renamed MOV file?
    (Both formats use same structure, but sometimes there is MP4-specific contents).