2023-10-11

Which atom (box) has subtitle data in MP4 (ISOBMFF)

In ISOBMFF (MP4), what atom (box) has subtitle information ? I have a MP4 File which has subtitle. Using FFMPEG, I input the subtitle in video.

ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt" -c:v libx264 -c:a aac -strict experimental -b:a 192k output.mp4

here is my original mp4 file dump. (Result of Mp4dump)

[ftyp] size=8+16
  major_brand = mp42
  minor_version = 0
  compatible_brand = isom
  compatible_brand = mp42
[moov] size=8+373326
  [mvhd] size=12+96
    timescale = 1000
    duration = 1187027
    duration(ms) = 1187027
  [trak] size=8+157859
    [tkhd] size=12+80, flags=3
      enabled = 1
      id = 1
      duration = 1187019
      width = 1280.000000
      height = 720.000000
    [mdia] size=8+157759
      [mdhd] size=12+20
        timescale = 30000
        duration = 35610575
        duration(ms) = 1187019
        language = und
      [hdlr] size=12+59
        handler_type = vide
        handler_name = ISO Media file produced by Google Inc.
      [minf] size=8+157648
        [dinf] size=8+28
          [dref] size=12+16
            [url ] size=12+0, flags=1
              location = [local to file]
        [stbl] size=8+157584
          [stsd] size=12+140
            entry_count = 1
            [avc1] size=8+128
              data_reference_index = 1
              width = 1280
              height = 720
              compressor =
              [avcC] size=8+42
                Configuration Version = 1
                Profile = High
                Profile Compatibility = 0
                Level = 31
                NALU Length Size = 4
                Sequence Parameter = [67 64 00 1f ac b4 02 80 2d d8 0b 50 10 10 14 00 00 0f a4 00 03 a9 80 3c 60 ca 80]
                Picture Parameter = [68 ee 3c b0]
          [stts] size=12+12
            entry_count = 1
          [stsc] size=12+1672
            entry_count = 139
          [stco] size=12+10228
            entry_count = 2556
          [stsz] size=12+142308
            sample_size = 0
            sample_count = 35575
          [stss] size=12+3152
            entry_count = 787
        [vmhd] size=12+8, flags=1
          graphics_mode = 0
          op_color = 0000,0000,0000
  [trak] size=8+215196
    [tkhd] size=12+80, flags=3
      enabled = 1
      id = 2
      duration = 1187027
      width = 0.000000
      height = 0.000000
    [mdia] size=8+215096
      [mdhd] size=12+20
        timescale = 44100
        duration = 52347904
        duration(ms) = 1187027
        language = eng
      [hdlr] size=12+59
        handler_type = soun
        handler_name = ISO Media file produced by Google Inc.
      [minf] size=8+214985
        [dinf] size=8+28
          [dref] size=12+16
            [url ] size=12+0, flags=1
              location = [local to file]
        [stbl] size=8+214925
          [stsd] size=12+93
            entry_count = 1
            [mp4a] size=8+81
              data_reference_index = 1
              channel_count = 2
              sample_size = 16
              sample_rate = 44100
              [esds] size=12+41
                [ESDescriptor] size=2+39
                  es_id = 2
                  stream_priority = 0
                  [DecoderConfig] size=2+31
                    stream_type = 5
                    object_type = 64
                    up_stream = 0
                    buffer_size = 0
                    max_bitrate = 0
                    avg_bitrate = 0
                    DecoderSpecificInfo = 12 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                  [Descriptor:06] size=2+1
          [stts] size=12+12
            entry_count = 1
          [stsc] size=12+40
            entry_count = 3
          [stco] size=12+10228
            entry_count = 2556
          [stsz] size=12+204492
            sample_size = 0
            sample_count = 51121
        [smhd] size=12+4
          balance = 0
  [udta] size=8+139
    [meta] size=12+127
      [hdlr] size=12+21
        handler_type = mdir
        handler_name =
      [ilst] size=8+86
        [.too] size=8+22
          [data] size=8+14
            type = 1
            lang = 0
            value = Google
        [gsst] size=8+17
        [gstd] size=8+23
[mdat] size=8+289495494

here is my new mp4 file (including subtitle) (Result of Mp4dump)

[ftyp] size=8+24
  major_brand = isom
  minor_version = 200
  compatible_brand = isom
  compatible_brand = iso2
  compatible_brand = avc1
  compatible_brand = mp41
[free] size=8+0
[mdat] size=8+289904585
[moov] size=8+1267713
  [mvhd] size=12+96
    timescale = 1000
    duration = 1187028
    duration(ms) = 1187028
  [trak] size=8+547052
    [tkhd] size=12+80, flags=3
      enabled = 1
      id = 1
      duration = 1187020
      width = 1280.000000
      height = 720.000000
    [edts] size=8+28
      [elst] size=12+16
        entry_count = 1
        entry/segment duration = 1187020
        entry/media time = 2002
        entry/media rate = 1
    [mdia] size=8+546916
      [mdhd] size=12+20
        timescale = 30000
        duration = 35610575
        duration(ms) = 1187019
        language = und
      [hdlr] size=12+59
        handler_type = vide
        handler_name = ISO Media file produced by Google Inc.
      [minf] size=8+546805
        [vmhd] size=12+8, flags=1
          graphics_mode = 0
          op_color = 0000,0000,0000
        [dinf] size=8+28
          [dref] size=12+16
            [url ] size=12+0, flags=1
              location = [local to file]
        [stbl] size=8+546741
          [stsd] size=12+201
            entry_count = 1
            [avc1] size=8+189
              data_reference_index = 1
              width = 1280
              height = 720
              compressor = Lavc59.37.100 libx264
              [avcC] size=8+48
                Configuration Version = 1
                Profile = High
                Profile Compatibility = 0
                Level = 31
                NALU Length Size = 4
                Sequence Parameter = [67 64 00 1f ac d9 40 50 05 bb 01 6a 02 02 02 80 00 01 f4 80 00 75 30 07 8c 18 cb]
                Picture Parameter = [68 eb e3 cb 22 c0]
              [colr] size=8+11
              [pasp] size=8+8
              [btrt] size=8+12
          [stts] size=12+12
            entry_count = 1
          [stss] size=12+2036
            entry_count = 508
          [ctts] size=12+259772
            entry_count = 32471
          [stsc] size=12+28
            entry_count = 2
          [stsz] size=12+142308
            sample_size = 0
            sample_count = 35575
          [stco] size=12+142300
            entry_count = 35574
  [trak] size=8+720439
    [tkhd] size=12+80, flags=3
      enabled = 1
      id = 2
      duration = 1187028
      width = 0.000000
      height = 0.000000
    [edts] size=8+28
      [elst] size=12+16
        entry_count = 1
        entry/segment duration = 1187027
        entry/media time = 1024
        entry/media rate = 1
    [mdia] size=8+720303
      [mdhd] size=12+20
        timescale = 44100
        duration = 52348928
        duration(ms) = 1187050
        language = eng
      [hdlr] size=12+59
        handler_type = soun
        handler_name = ISO Media file produced by Google Inc.
      [minf] size=8+720192
        [smhd] size=12+4
          balance = 0
        [dinf] size=8+28
          [dref] size=12+16
            [url ] size=12+0, flags=1
              location = [local to file]
        [stbl] size=8+720132
          [stsd] size=12+114
            entry_count = 1
            [mp4a] size=8+102
              data_reference_index = 1
              channel_count = 2
              sample_size = 16
              sample_rate = 44100
              [esds] size=12+42
                [ESDescriptor] size=5+37
                  es_id = 2
                  stream_priority = 0
                  [DecoderConfig] size=5+23
                    stream_type = 5
                    object_type = 64
                    up_stream = 0
                    buffer_size = 0
                    max_bitrate = 196932
                    avg_bitrate = 196932
                    DecoderSpecificInfo = 12 10 56 e5 00
                  [Descriptor:06] size=5+1
              [btrt] size=8+12
          [stts] size=12+12
            entry_count = 1
          [stsc] size=12+373096
            entry_count = 31091
          [stsz] size=12+204496
            sample_size = 0
            sample_count = 51122
          [stco] size=12+142300
            entry_count = 35574
          [sgpd] size=12+14, version=1
            grouping_type = roll
            default_length = 2
            entry_count = 1
            entries:
              (       0) [ff ff]
          [sbgp] size=12+16
            grouping_type = roll
            entry_count = 1
  [udta] size=8+90
    [meta] size=12+78
      [hdlr] size=12+21
        handler_type = mdir
        handler_name =
      [ilst] size=8+37
        [.too] size=8+29
          [data] size=8+21
            type = 1
            lang = 0
            value = Lavf59.27.100

I do not find diffrence of input.mp4 file and output.mp4 file. (Definitely Subtitle is applied well.)



No comments:

Post a Comment