alfg/mp4

Minor version parsing for ftyp box

sr1990 opened this issue · 4 comments

The mp4dump minor brand output for ftyp box is different than what I get with this tool:
Mp4dump output:

[ftyp] size=8+24
  major_brand = isom
  minor_version = 200
  compatible_brand = isom
  compatible_brand = iso2
  compatible_brand = avc1
  compatible_brand = mp41

Using this tool:

FTYP MAJOR:  isom
FTYP MINOR:  512
FTYP COMPATIBLE:  [isom iso2 avc1 mp41]
alfg commented

Hey @sr1990 🙂,

Not sure why Bento's mp4dump is displaying 200, but I also noticed ffprobe and mp4box display 512 as the ftyp minor_version.

mp4box:

mp4box tears-of-steel.mp4 -info
* Movie Info *
        Timescale 1000 - 2 tracks
        Computed Duration 00:00:02.125 - Indicated Duration 00:00:02.485
        Fragmented File: no
        File Brand isom - version 512
                Compatible brands: isom iso2 avc1 mp41

ffprobe:

ffprobe.exe tears-of-steel.mp4
ffprobe version 3.3.1 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tears-of-steel.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.71.100
  Duration: 00:00:02.49, start: -0.015420, bitrate: 9257 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x800 [SAR 1:1 DAR 12:5], 9155 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

mp4dump:

mp4dump tears-of-steel.mp4
[ftyp] size=8+24
  major_brand = isom
  minor_version = 200
  compatible_brand = isom
  compatible_brand = iso2
  compatible_brand = avc1
  compatible_brand = mp41

🤔

Looks like mp4dump is showing the HEX value.

They have the following method to read ftyp box in Ap4FtypAtom.cpp:

AP4_Result
AP4_FtypAtom::InspectFields(AP4_AtomInspector& inspector)
{
    char name[5];
    AP4_FormatFourChars(name, m_MajorBrand);
    inspector.AddField("major_brand", name);
    inspector.AddField("minor_version", m_MinorVersion, AP4_AtomInspector::HINT_HEX);

    // compatible brands
    for (unsigned int i=0; i<m_CompatibleBrands.ItemCount(); i++) {
        AP4_UI32 cb = m_CompatibleBrands[i];
        AP4_FormatFourChars(name, cb);
        inspector.AddField("compatible_brand", name);
    }

    return AP4_SUCCESS;
}
alfg commented

Ah, yeah that makes sense then.

$ printf "%x\n" 512
200

Good find!