Menu

Smaller size after adding?

Help
2015-05-08
2015-06-30
  • Giuseppe Rossi

    Giuseppe Rossi - 2015-05-08

    Hello,
    I am doing some tests with MP4Box and I have a stupid issue I do not understand the reason for.

    Let's assume I have a MP4 file with two tracks: a video track in H.264 and an audio track in AAC.

    The result of -info on this file is the following:

    • Movie Info *
      Timescale 90000 - Duration 00:27:49.461
      Fragmented File no - 2 track(s)
      File suitable for progressive download (moov before mdat)
      File Brand mp42 - version 0
      Created: GMT Thu May 7 22:01:42 2015

    File has no MPEG4 IOD/OD

    Track # 1 Info - TrackID 1 - TimeScale 25000 - Duration 00:27:49.440
    Media Info: Language "English" - Type "vide:avc1" - 41736 samples
    Visual Track layout: x=0 y=0 width=1280 height=720
    MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
    AVC/H264 Video - Visual Size 1280 x 720
    AVC Info: 1 SPS - 1 PPS - Profile Main @ Level 3.1
    NAL Unit length bits: 32
    Pixel Aspect Ratio 1:1 - Indicated track size 1280 x 720
    Self-synchronized

    Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:27:49.461
    Media Info: Language "English" - Type "soun:mp4a" - 78256 samples
    MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
    MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
    Synchronized on stream 1

    The size of this file is: 548434207 bytes
    Now I extract (-raw) the two tracks and I got the two tracks with the following size:

    • video: 521447844
    • audio: 26724280

    This is I think normal: the size of the two tracks is a bit smaller than the size of the full container.

    Now I create a new MP4 file from Mp4Box as:

    MP4Box -add sidetrack.h264 newfile.mp4 -new

    now even before adding the audio track the result is a file smaller than the raw H.264 track.

    New size (only video) is: 473851736

    How is that possible? The final result is as well that the computed bitrate is reduced (as the video duration is the same but the file size is smaller).

    What exactly is removed? I tried looking at the result of the info file (below) but I do not see any difference that could explain this.

    • Movie Info *
      Timescale 600 - Duration 00:27:49.440
      Fragmented File no - 1 track(s)
      File suitable for progressive download (moov before mdat)
      File Brand isom - version 1
      Created: GMT Fri May 8 16:08:57 2015

    File has root IOD (9 bytes)
    Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
    Visual PL: AVC/H264 Profile (0x15)
    Audio PL: No audio capability required (0xff)
    No streams included in root OD

    Track # 1 Info - TrackID 1 - TimeScale 100 - Duration 00:27:49.440
    Media Info: Language "Undetermined" - Type "vide:avc1" - 41736 samples
    Visual Track layout: x=0 y=0 width=1280 height=720
    MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
    AVC/H264 Video - Visual Size 1280 x 720
    AVC Info: 1 SPS - 1 PPS - Profile Main @ Level 3.1
    NAL Unit length bits: 32
    Pixel Aspect Ratio 1:1 - Indicated track size 1280 x 720
    Self-synchronized

    Thanks for the help!

     
  • Jean Le Feuvre

    Jean Le Feuvre - 2015-06-30

    A few things may change during import/export:
    - stuffing bytes
    - SPS/PPS are shared, present in the avc1 sample description only
    - nalu start codes (3 or 4 bytes) are re-written into size fields of 1, 2 or 4 bytes