From 45b00aabd4ec137c9e2d43bcc97792c7cbcda65f Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Mon, 7 Feb 2022 12:35:11 +0100 Subject: [PATCH] mp4: Add stz2 support --- format/mp4/boxes.go | 26 ++ format/mp4/testdata/stz2.fqtest | 478 ++++++++++++++++++++++++++++++++ format/mp4/testdata/stz2.mp4 | Bin 0 -> 1328 bytes 3 files changed, 504 insertions(+) create mode 100644 format/mp4/testdata/stz2.fqtest create mode 100644 format/mp4/testdata/stz2.mp4 diff --git a/format/mp4/boxes.go b/format/mp4/boxes.go index c08dc916..6dd5ed8b 100644 --- a/format/mp4/boxes.go +++ b/format/mp4/boxes.go @@ -531,6 +531,9 @@ func init() { // TODO: bytes_per_sample from audio stsd? sampleSize := d.FieldU32("sample_size") entryCount := d.FieldU32("entry_count") + if ctx.currentTrack != nil && len(ctx.currentTrack.stsz) > 0 { + d.Errorf("multiple stsz or stz2 boxes") + } if sampleSize == 0 { var i uint64 d.FieldArrayLoop("entries", func() bool { return i < entryCount }, func(d *decode.D) { @@ -552,6 +555,29 @@ func init() { } } }, + "stz2": func(ctx *decodeContext, d *decode.D) { + d.FieldU8("version") + d.FieldU24("flags") + fieldSize := d.FieldU32("field_size") + if fieldSize > 16 { + d.Errorf("field_size %d > 16", fieldSize) + } + entryCount := d.FieldU32("entry_count") + var i uint64 + if ctx.currentTrack != nil && len(ctx.currentTrack.stsz) > 0 { + d.Errorf("multiple stsz or stz2 boxes") + } + d.FieldArrayLoop("entries", func() bool { return i < entryCount }, func(d *decode.D) { + size := uint32(d.FieldU("size", int(fieldSize))) + if ctx.currentTrack != nil { + ctx.currentTrack.stsz = append(ctx.currentTrack.stsz, stsz{ + size: int64(size), + count: 1, + }) + } + i++ + }) + }, "stco": func(ctx *decodeContext, d *decode.D) { d.FieldU8("version") d.FieldU24("flags") diff --git a/format/mp4/testdata/stz2.fqtest b/format/mp4/testdata/stz2.fqtest new file mode 100644 index 00000000..5523d6c7 --- /dev/null +++ b/format/mp4/testdata/stz2.fqtest @@ -0,0 +1,478 @@ +# mp4box -add mp3.mp4:stz2 -new stz2.mp4 +$ fq -d mp4 'dv' stz2.mp4 + |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: stz2.mp4 (mp4) 0x0-0x52f.7 (1328) + | | | boxes[0:4]: 0x0-0x52f.7 (1328) + | | | [0]{}: box 0x0-0x13.7 (20) +0x000|00 00 00 14 |.... | size: 20 0x0-0x3.7 (4) +0x000| 66 74 79 70 | ftyp | type: "ftyp" (File type and compatibility) 0x4-0x7.7 (4) +0x000| 69 73 6f 6d | isom | major_brand: "isom" 0x8-0xb.7 (4) +0x000| 00 00 00 01| ....| minor_version: 1 0xc-0xf.7 (4) + | | | brands[0:1]: 0x10-0x13.7 (4) +0x010|69 73 6f 6d |isom | [0]: "isom" brand (All files based on the ISO Base Media File Format) 0x10-0x13.7 (4) + | | | [1]{}: box 0x14-0x27b.7 (616) +0x010| 00 00 02 68 | ...h | size: 616 0x14-0x17.7 (4) +0x010| 6d 6f 6f 76 | moov | type: "moov" (Container for all the meta-data) 0x18-0x1b.7 (4) + | | | boxes[0:3]: 0x1c-0x27b.7 (608) + | | | [0]{}: box 0x1c-0x87.7 (108) +0x010| 00 00 00 6c| ...l| size: 108 0x1c-0x1f.7 (4) +0x020|6d 76 68 64 |mvhd | type: "mvhd" (Movie header, overall declarations) 0x20-0x23.7 (4) +0x020| 00 | . | version: 0 0x24-0x24.7 (1) +0x020| 00 00 00 | ... | flags: 0 0x25-0x27.7 (3) +0x020| de 26 b1 49 | .&.I | creation_time: "2022-02-10T11:21:45Z" (3727077705) 0x28-0x2b.7 (4) +0x020| de 26 b1 49| .&.I| modification_time: "2022-02-10T11:21:45Z" (3727077705) 0x2c-0x2f.7 (4) +0x030|00 00 03 e8 |.... | time_scale: 1000 0x30-0x33.7 (4) +0x030| 00 00 00 32 | ...2 | duration: 50 0x34-0x37.7 (4) +0x030| 00 01 00 00 | .... | preferred_rate: 1 0x38-0x3b.7 (4) +0x030| 01 00 | .. | preferred_volume: 1 0x3c-0x3d.7 (2) +0x030| 00 00| ..| reserved: "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" 0x3e-0x47.7 (10) +0x040|00 00 00 00 00 00 00 00 |........ | + | | | matrix_structure{}: 0x48-0x6b.7 (36) +0x040| 00 01 00 00 | .... | a: 1 0x48-0x4b.7 (4) +0x040| 00 00 00 00| ....| b: 0 0x4c-0x4f.7 (4) +0x050|00 00 00 00 |.... | u: 0 0x50-0x53.7 (4) +0x050| 00 00 00 00 | .... | c: 0 0x54-0x57.7 (4) +0x050| 00 01 00 00 | .... | d: 1 0x58-0x5b.7 (4) +0x050| 00 00 00 00| ....| v: 0 0x5c-0x5f.7 (4) +0x060|00 00 00 00 |.... | x: 0 0x60-0x63.7 (4) +0x060| 00 00 00 00 | .... | y: 0 0x64-0x67.7 (4) +0x060| 40 00 00 00 | @... | w: 1 0x68-0x6b.7 (4) +0x060| 00 00 00 00| ....| preview_time: 0 0x6c-0x6f.7 (4) +0x070|00 00 00 00 |.... | preview_duration: 0 0x70-0x73.7 (4) +0x070| 00 00 00 00 | .... | poster_time: 0 0x74-0x77.7 (4) +0x070| 00 00 00 00 | .... | selection_time: 0 0x78-0x7b.7 (4) +0x070| 00 00 00 00| ....| selection_duration: 0 0x7c-0x7f.7 (4) +0x080|00 00 00 00 |.... | current_time: 0 0x80-0x83.7 (4) +0x080| 00 00 00 02 | .... | next_track_id: 2 0x84-0x87.7 (4) + | | | [1]{}: box 0x88-0x9c.7 (21) +0x080| 00 00 00 15 | .... | size: 21 0x88-0x8b.7 (4) +0x080| 69 6f 64 73| iods| type: "iods" (Object Descriptor container box) 0x8c-0x8f.7 (4) +0x090|00 00 00 00 10 07 00 4f ff ff fe ff ff |.......O..... | data: raw bits 0x90-0x9c.7 (13) + | | | [2]{}: box 0x9d-0x27b.7 (479) +0x090| 00 00 01| ...| size: 479 0x9d-0xa0.7 (4) +0x0a0|df |. | +0x0a0| 74 72 61 6b | trak | type: "trak" (Container for an individual track or stream) 0xa1-0xa4.7 (4) + | | | boxes[0:3]: 0xa5-0x27b.7 (471) + | | | [0]{}: box 0xa5-0x100.7 (92) +0x0a0| 00 00 00 5c | ...\ | size: 92 0xa5-0xa8.7 (4) +0x0a0| 74 6b 68 64 | tkhd | type: "tkhd" (Track header, overall information about the track) 0xa9-0xac.7 (4) +0x0a0| 00 | . | version: 0 0xad-0xad.7 (1) +0x0a0| 00 00| ..| flags: 3 0xae-0xb0.7 (3) +0x0b0|03 |. | +0x0b0| 00 00 00 00 | .... | creation_time: "1904-01-04T00:00:00Z" (0) 0xb1-0xb4.7 (4) +0x0b0| de 26 b1 49 | .&.I | modification_time: "2022-02-10T11:21:45Z" (3727077705) 0xb5-0xb8.7 (4) +0x0b0| 00 00 00 01 | .... | track_id: 1 0xb9-0xbc.7 (4) +0x0b0| 00 00 00| ...| reserved1: 0 0xbd-0xc0.7 (4) +0x0c0|00 |. | +0x0c0| 00 00 00 32 | ...2 | duration: 50 0xc1-0xc4.7 (4) +0x0c0| 00 00 00 00 00 00 00 00 | ........ | reserved2: raw bits 0xc5-0xcc.7 (8) +0x0c0| 00 00 | .. | layer: 0 0xcd-0xce.7 (2) +0x0c0| 00| .| alternate_group: 1 0xcf-0xd0.7 (2) +0x0d0|01 |. | +0x0d0| 01 00 | .. | volume: 1 0xd1-0xd2.7 (2) +0x0d0| 00 00 | .. | reserved3: 0 0xd3-0xd4.7 (2) + | | | matrix_structure{}: 0xd5-0xf8.7 (36) +0x0d0| 00 01 00 00 | .... | a: 1 0xd5-0xd8.7 (4) +0x0d0| 00 00 00 00 | .... | b: 0 0xd9-0xdc.7 (4) +0x0d0| 00 00 00| ...| u: 0 0xdd-0xe0.7 (4) +0x0e0|00 |. | +0x0e0| 00 00 00 00 | .... | c: 0 0xe1-0xe4.7 (4) +0x0e0| 00 01 00 00 | .... | d: 1 0xe5-0xe8.7 (4) +0x0e0| 00 00 00 00 | .... | v: 0 0xe9-0xec.7 (4) +0x0e0| 00 00 00| ...| x: 0 0xed-0xf0.7 (4) +0x0f0|00 |. | +0x0f0| 00 00 00 00 | .... | y: 0 0xf1-0xf4.7 (4) +0x0f0| 40 00 00 00 | @... | w: 1 0xf5-0xf8.7 (4) +0x0f0| 00 00 00 00 | .... | track_width: 0 0xf9-0xfc.7 (4) +0x0f0| 00 00 00| ...| track_height: 0 0xfd-0x100.7 (4) +0x100|00 |. | + | | | [1]{}: box 0x101-0x124.7 (36) +0x100| 00 00 00 24 | ...$ | size: 36 0x101-0x104.7 (4) +0x100| 65 64 74 73 | edts | type: "edts" (Edit list container) 0x105-0x108.7 (4) + | | | boxes[0:1]: 0x109-0x124.7 (28) + | | | [0]{}: box 0x109-0x124.7 (28) +0x100| 00 00 00 1c | .... | size: 28 0x109-0x10c.7 (4) +0x100| 65 6c 73| els| type: "elst" (An edit list) 0x10d-0x110.7 (4) +0x110|74 |t | +0x110| 00 | . | version: 0 0x111-0x111.7 (1) +0x110| 00 00 00 | ... | flags: 0 0x112-0x114.7 (3) +0x110| 00 00 00 01 | .... | entry_count: 1 0x115-0x118.7 (4) + | | | entries[0:1]: 0x119-0x124.7 (12) + | | | [0]{}: entry 0x119-0x124.7 (12) +0x110| 00 00 00 32 | ...2 | segment_duration: 50 0x119-0x11c.7 (4) +0x110| 00 00 04| ...| media_time: 1105 0x11d-0x120.7 (4) +0x120|51 |Q | +0x120| 00 01 00 00 | .... | media_rate: 1 0x121-0x124.7 (4) + | | | [2]{}: box 0x125-0x27b.7 (343) +0x120| 00 00 01 57 | ...W | size: 343 0x125-0x128.7 (4) +0x120| 6d 64 69 61 | mdia | type: "mdia" (Container for the media information in a track) 0x129-0x12c.7 (4) + | | | boxes[0:3]: 0x12d-0x27b.7 (335) + | | | [0]{}: box 0x12d-0x14c.7 (32) +0x120| 00 00 00| ...| size: 32 0x12d-0x130.7 (4) +0x130|20 | | +0x130| 6d 64 68 64 | mdhd | type: "mdhd" (Media header, overall information about the media) 0x131-0x134.7 (4) +0x130| 00 | . | version: 0 0x135-0x135.7 (1) +0x130| 00 00 00 | ... | flags: 0 0x136-0x138.7 (3) +0x130| 00 00 00 00 | .... | creation_time: "1904-01-04T00:00:00Z" (0) 0x139-0x13c.7 (4) +0x130| de 26 b1| .&.| modification_time: "2022-02-10T11:21:45Z" (3727077705) 0x13d-0x140.7 (4) +0x140|49 |I | +0x140| 00 00 ac 44 | ...D | time_scale: 44100 0x141-0x144.7 (4) +0x140| 00 00 0c ee | .... | duration: 3310 0x145-0x148.7 (4) +0x140| 55 c4 | U. | language: "und" 0x149-0x14a.7 (2) +0x140| 00 00 | .. | quality: 0 0x14b-0x14c.7 (2) + | | | [1]{}: box 0x14d-0x179.7 (45) +0x140| 00 00 00| ...| size: 45 0x14d-0x150.7 (4) +0x150|2d |- | +0x150| 68 64 6c 72 | hdlr | type: "hdlr" (Handler, declares the media (handler) type) 0x151-0x154.7 (4) +0x150| 00 | . | version: 0 0x155-0x155.7 (1) +0x150| 00 00 00 | ... | flags: 0 0x156-0x158.7 (3) +0x150| 00 00 00 00 | .... | component_type: "" 0x159-0x15c.7 (4) +0x150| 73 6f 75| sou| component_subtype: "soun" (Audio Track) 0x15d-0x160.7 (4) +0x160|6e |n | +0x160| 00 00 00 00 | .... | component_manufacturer: "" 0x161-0x164.7 (4) +0x160| 00 00 00 00 | .... | component_flags: 0 0x165-0x168.7 (4) +0x160| 00 00 00 00 | .... | component_flags_mask: 0 0x169-0x16c.7 (4) +0x160| 53 6f 75| Sou| component_name: "SoundHandler" 0x16d-0x179.7 (13) +0x170|6e 64 48 61 6e 64 6c 65 72 00 |ndHandler. | + | | | [2]{}: box 0x17a-0x27b.7 (258) +0x170| 00 00 01 02 | .... | size: 258 0x17a-0x17d.7 (4) +0x170| 6d 69| mi| type: "minf" (Media information container) 0x17e-0x181.7 (4) +0x180|6e 66 |nf | + | | | boxes[0:3]: 0x182-0x27b.7 (250) + | | | [0]{}: box 0x182-0x191.7 (16) +0x180| 00 00 00 10 | .... | size: 16 0x182-0x185.7 (4) +0x180| 73 6d 68 64 | smhd | type: "smhd" (Sound media header, overall information (sound track only)) 0x186-0x189.7 (4) +0x180| 00 | . | version: 0 0x18a-0x18a.7 (1) +0x180| 00 00 00 | ... | flags: 0 0x18b-0x18d.7 (3) +0x180| 00 00| ..| balance: 0 0x18e-0x18f.7 (2) +0x190|00 00 |.. | reserved: 0 0x190-0x191.7 (2) + | | | [1]{}: box 0x192-0x1b5.7 (36) +0x190| 00 00 00 24 | ...$ | size: 36 0x192-0x195.7 (4) +0x190| 64 69 6e 66 | dinf | type: "dinf" (Data information box, container) 0x196-0x199.7 (4) + | | | boxes[0:1]: 0x19a-0x1b5.7 (28) + | | | [0]{}: box 0x19a-0x1b5.7 (28) +0x190| 00 00 00 1c | .... | size: 28 0x19a-0x19d.7 (4) +0x190| 64 72| dr| type: "dref" (Data reference box, declares source(s) of media data in track) 0x19e-0x1a1.7 (4) +0x1a0|65 66 |ef | +0x1a0| 00 | . | version: 0 0x1a2-0x1a2.7 (1) +0x1a0| 00 00 00 | ... | flags: 0 0x1a3-0x1a5.7 (3) +0x1a0| 00 00 00 01 | .... | entry_count: 1 0x1a6-0x1a9.7 (4) + | | | boxes[0:1]: 0x1aa-0x1b5.7 (12) + | | | [0]{}: box 0x1aa-0x1b5.7 (12) +0x1a0| 00 00 00 0c | .... | size: 12 0x1aa-0x1ad.7 (4) +0x1a0| 75 72| ur| type: "url " 0x1ae-0x1b1.7 (4) +0x1b0|6c 20 |l | +0x1b0| 00 | . | version: 0 0x1b2-0x1b2.7 (1) +0x1b0| 00 00 01 | ... | flags: 1 0x1b3-0x1b5.7 (3) + | | | data: raw bits 0x1b6-NA (0) + | | | [2]{}: box 0x1b6-0x27b.7 (198) +0x1b0| 00 00 00 c6 | .... | size: 198 0x1b6-0x1b9.7 (4) +0x1b0| 73 74 62 6c | stbl | type: "stbl" (Sample table box, container for the time/space map) 0x1ba-0x1bd.7 (4) + | | | boxes[0:5]: 0x1be-0x27b.7 (190) + | | | [0]{}: box 0x1be-0x214.7 (87) +0x1b0| 00 00| ..| size: 87 0x1be-0x1c1.7 (4) +0x1c0|00 57 |.W | +0x1c0| 73 74 73 64 | stsd | type: "stsd" (Sample descriptions (codec types, initialization etc.)) 0x1c2-0x1c5.7 (4) +0x1c0| 00 | . | version: 0 0x1c6-0x1c6.7 (1) +0x1c0| 00 00 00 | ... | flags: 0 0x1c7-0x1c9.7 (3) +0x1c0| 00 00 00 01 | .... | entry_count: 1 0x1ca-0x1cd.7 (4) + | | | boxes[0:1]: 0x1ce-0x214.7 (71) + | | | [0]{}: box 0x1ce-0x214.7 (71) +0x1c0| 00 00| ..| size: 71 0x1ce-0x1d1.7 (4) +0x1d0|00 47 |.G | +0x1d0| 6d 70 34 61 | mp4a | type: "mp4a" 0x1d2-0x1d5.7 (4) +0x1d0| 00 00 00 00 00 00 | ...... | reserved: raw bits 0x1d6-0x1db.7 (6) +0x1d0| 00 01 | .. | data_reference_index: 1 0x1dc-0x1dd.7 (2) +0x1d0| 00 00| ..| version: 0 0x1de-0x1df.7 (2) +0x1e0|00 00 |.. | revision_level: 0 0x1e0-0x1e1.7 (2) +0x1e0| 00 00 00 00 | .... | max_packet_size: 0 0x1e2-0x1e5.7 (4) +0x1e0| 00 02 | .. | num_audio_channels: 2 0x1e6-0x1e7.7 (2) +0x1e0| 00 10 | .. | sample_size: 16 0x1e8-0x1e9.7 (2) +0x1e0| 00 00 | .. | compression_id: 0 0x1ea-0x1eb.7 (2) +0x1e0| 00 00 | .. | packet_size: 0 0x1ec-0x1ed.7 (2) +0x1e0| ac 44| .D| sample_rate: 44100 0x1ee-0x1f1.7 (4) +0x1f0|00 00 |.. | + | | | boxes[0:1]: 0x1f2-0x214.7 (35) + | | | [0]{}: box 0x1f2-0x214.7 (35) +0x1f0| 00 00 00 23 | ...# | size: 35 0x1f2-0x1f5.7 (4) +0x1f0| 65 73 64 73 | esds | type: "esds" (Elementary stream descriptor) 0x1f6-0x1f9.7 (4) +0x1f0| 00 00 00 00 | .... | version: 0 0x1fa-0x1fd.7 (4) + | | | descriptor{}: (mpeg_es) 0x1fe-0x214.7 (23) +0x1f0| 03 | . | tag_id: "ES_DescrTag" (3) 0x1fe-0x1fe.7 (1) +0x1f0| 15| .| length: 21 0x1ff-0x1ff.7 (1) +0x200|00 00 |.. | es_id: 0 0x200-0x201.7 (2) +0x200| 00 | . | stream_dependency_flag: false 0x202-0x202 (0.1) +0x200| 00 | . | url_flag: false 0x202.1-0x202.1 (0.1) +0x200| 00 | . | ocr_stream_flag: false 0x202.2-0x202.2 (0.1) +0x200| 00 | . | stream_priority: 0 0x202.3-0x202.7 (0.5) + | | | dec_config_descr{}: 0x203-0x211.7 (15) +0x200| 04 | . | tag_id: "DecoderConfigDescrTag" (4) 0x203-0x203.7 (1) +0x200| 0d | . | length: 13 0x204-0x204.7 (1) +0x200| 6b | k | object_type_indication: "MPEGObjectTypeMP3" (107) 0x205-0x205.7 (1) +0x200| 15 | . | stream_type: "AudioStream" (5) 0x206-0x206.5 (0.6) +0x200| 15 | . | upstream: false 0x206.6-0x206.6 (0.1) +0x200| 15 | . | specific_info_flag: true 0x206.7-0x206.7 (0.1) +0x200| 00 00 d1 | ... | buffer_size_db: 209 0x207-0x209.7 (3) +0x200| 00 01 04 a0 | .... | max_bit_rate: 66720 0x20a-0x20d.7 (4) +0x200| 00 01| ..| avg_bit_rate: 66720 0x20e-0x211.7 (4) +0x210|04 a0 |.. | + | | | sl_config_descr{}: 0x212-0x214.7 (3) +0x210| 06 | . | tag_id: "SLConfigDescrTag" (6) 0x212-0x212.7 (1) +0x210| 01 | . | length: 1 0x213-0x213.7 (1) +0x210| 02 | . | data: raw bits 0x214-0x214.7 (1) + | | | [1]{}: box 0x215-0x234.7 (32) +0x210| 00 00 00 20 | ... | size: 32 0x215-0x218.7 (4) +0x210| 73 74 74 73 | stts | type: "stts" (Sample time-to-sample) 0x219-0x21c.7 (4) +0x210| 00 | . | version: 0 0x21d-0x21d.7 (1) +0x210| 00 00| ..| flags: 0 0x21e-0x220.7 (3) +0x220|00 |. | +0x220| 00 00 00 02 | .... | entry_count: 2 0x221-0x224.7 (4) + | | | entries[0:2]: 0x225-0x234.7 (16) + | | | [0]{}: entry 0x225-0x22c.7 (8) +0x220| 00 00 00 02 | .... | count: 2 0x225-0x228.7 (4) +0x220| 00 00 04 80 | .... | delta: 1152 0x229-0x22c.7 (4) + | | | [1]{}: entry 0x22d-0x234.7 (8) +0x220| 00 00 00| ...| count: 1 0x22d-0x230.7 (4) +0x230|01 |. | +0x230| 00 00 03 ee | .... | delta: 1006 0x231-0x234.7 (4) + | | | [2]{}: box 0x235-0x250.7 (28) +0x230| 00 00 00 1c | .... | size: 28 0x235-0x238.7 (4) +0x230| 73 74 73 63 | stsc | type: "stsc" (Sample-to-chunk, partial data-offset information) 0x239-0x23c.7 (4) +0x230| 00 | . | version: 0 0x23d-0x23d.7 (1) +0x230| 00 00| ..| flags: 0 0x23e-0x240.7 (3) +0x240|00 |. | +0x240| 00 00 00 01 | .... | entry_count: 1 0x241-0x244.7 (4) + | | | entries[0:1]: 0x245-0x250.7 (12) + | | | [0]{}: entry 0x245-0x250.7 (12) +0x240| 00 00 00 01 | .... | first_chunk: 1 0x245-0x248.7 (4) +0x240| 00 00 00 03 | .... | samples_per_chunk: 3 0x249-0x24c.7 (4) +0x240| 00 00 00| ...| sample_description_id: 1 0x24d-0x250.7 (4) +0x250|01 |. | + | | | [3]{}: box 0x251-0x267.7 (23) +0x250| 00 00 00 17 | .... | size: 23 0x251-0x254.7 (4) +0x250| 73 74 7a 32 | stz2 | type: "stz2" (Compact sample sizes (framing)) 0x255-0x258.7 (4) +0x250| 00 | . | version: 0 0x259-0x259.7 (1) +0x250| 00 00 00 | ... | flags: 0 0x25a-0x25c.7 (3) +0x250| 00 00 00| ...| field_size: 8 0x25d-0x260.7 (4) +0x260|08 |. | +0x260| 00 00 00 03 | .... | entry_count: 3 0x261-0x264.7 (4) + | | | entries[0:3]: 0x265-0x267.7 (3) +0x260| d0 | . | [0]: 208 size 0x265-0x265.7 (1) +0x260| d1 | . | [1]: 209 size 0x266-0x266.7 (1) +0x260| d1 | . | [2]: 209 size 0x267-0x267.7 (1) + | | | [4]{}: box 0x268-0x27b.7 (20) +0x260| 00 00 00 14 | .... | size: 20 0x268-0x26b.7 (4) +0x260| 73 74 63 6f| stco| type: "stco" (Chunk offset, partial data-offset information) 0x26c-0x26f.7 (4) +0x270|00 |. | version: 0 0x270-0x270.7 (1) +0x270| 00 00 00 | ... | flags: 0 0x271-0x273.7 (3) +0x270| 00 00 00 01 | .... | entry_count: 1 0x274-0x277.7 (4) + | | | entries[0:1]: 0x278-0x27b.7 (4) +0x270| 00 00 02 84 | .... | [0]: 644 chunk_offset 0x278-0x27b.7 (4) + | | | [2]{}: box 0x27c-0x4f5.7 (634) +0x270| 00 00 02 7a| ...z| size: 634 0x27c-0x27f.7 (4) +0x280|6d 64 61 74 |mdat | type: "mdat" (Media data container) 0x280-0x283.7 (4) +0x280| ff fb 50 c4 00 00 0a 2c 43 2e 55 94| ..P....,C.U.| data: raw bits 0x284-0x4f5.7 (626) +0x290|80 01 81 15 66 23 3a d0 00 07 aa c3 8e 33 85 d3|....f#:......3..| +* |until 0x4f5.7 (626) | | + | | | [3]{}: box 0x4f6-0x52f.7 (58) +0x4f0| 00 00 00 3a | ...: | size: 58 0x4f6-0x4f9.7 (4) +0x4f0| 66 72 65 65 | free | type: "free" (Free space) 0x4fa-0x4fd.7 (4) +0x4f0| 49 73| Is| data: raw bits 0x4fe-0x52f.7 (50) +0x500|6f 4d 65 64 69 61 20 46 69 6c 65 20 50 72 6f 64|oMedia File Prod| +* |until 0x52f.7 (end) (50) | | + | | | tracks[0:1]: 0x284-0x4f5.7 (626) + | | | [0]{}: track 0x284-0x4f5.7 (626) + | | | samples[0:3]: 0x284-0x4f5.7 (626) + | | | [0]{}: sample (mp3_frame) 0x284-0x353.7 (208) + | | | header{}: 0x284-0x287.7 (4) +0x280| ff fb | .. | sync: 0b11111111111 (valid) 0x284-0x285.2 (1.3) +0x280| fb | . | mpeg_version: "1" (3) (MPEG Version 1) 0x285.3-0x285.4 (0.2) +0x280| fb | . | layer: 3 (1) (MPEG Layer 3) 0x285.5-0x285.6 (0.2) + | | | sample_count: 1152 0x285.7-NA (0) +0x280| fb | . | protection_absent: true (No CRC) 0x285.7-0x285.7 (0.1) +0x280| 50 | P | bitrate: 64000 (5) 0x286-0x286.3 (0.4) +0x280| 50 | P | sample_rate: 44100 (0) 0x286.4-0x286.5 (0.2) +0x280| 50 | P | padding: "Not padded" (0b0) 0x286.6-0x286.6 (0.1) +0x280| 50 | P | private: 0 0x286.7-0x286.7 (0.1) +0x280| c4 | . | channels: "Mono" (0b11) 0x287-0x287.1 (0.2) +0x280| c4 | . | channel_mode: "None" (0b0) 0x287.2-0x287.3 (0.2) +0x280| c4 | . | copyright: 0 0x287.4-0x287.4 (0.1) +0x280| c4 | . | original: 1 0x287.5-0x287.5 (0.1) +0x280| c4 | . | emphasis: "None" (0b0) 0x287.6-0x287.7 (0.2) + | | | side_info{}: 0x288-0x298.7 (17) +0x280| 00 00 | .. | main_data_end: 0 0x288-0x289 (1.1) +0x280| 00 | . | private_bits: 0 0x289.1-0x289.5 (0.5) +0x280| 00 0a | .. | share0: 0 0x289.6-0x28a.1 (0.4) + | | | granules[0:2]: 0x28a.2-0x298.7 (14.6) + | | | [0]{}: granule 0x28a.2-0x291.4 (7.3) + | | | channels[0:1]: 0x28a.2-0x291.4 (7.3) + | | | [0]{}: channel 0x28a.2-0x291.4 (7.3) +0x280| 0a 2c | ., | part2_3_length: 651 0x28a.2-0x28b.5 (1.4) +0x280| 2c 43 | ,C | big_values: 33 0x28b.6-0x28c.6 (1.1) +0x280| 43 2e | C. | global_gain: 151 0x28c.7-0x28d.6 (1) +0x280| 2e 55 | .U | scalefac_compress: 2 0x28d.7-0x28e.2 (0.4) +0x280| 55 | U | blocksplit_flag: 1 0x28e.3-0x28e.3 (0.1) +0x280| 55 | U | block_type: "start block" (1) 0x28e.4-0x28e.5 (0.2) +0x280| 55 | U | switch_point: 0 0x28e.6-0x28e.6 (0.1) +0x280| 55 94| U.| table_select0: 25 0x28e.7-0x28f.3 (0.5) +0x280| 94| .| table_select1: 9 0x28f.4-0x290 (0.5) +0x290|80 |. | +0x290|80 |. | subblock_gain0: 0 0x290.1-0x290.3 (0.3) +0x290|80 |. | subblock_gain1: 0 0x290.4-0x290.6 (0.3) +0x290|80 01 |.. | subblock_gain2: 0 0x290.7-0x291.1 (0.3) +0x290| 01 | . | preflag: 0 0x291.2-0x291.2 (0.1) +0x290| 01 | . | scalefac_scale: 0 0x291.3-0x291.3 (0.1) +0x290| 01 | . | count1table_select: 0 0x291.4-0x291.4 (0.1) + | | | [1]{}: granule 0x291.5-0x298.7 (7.3) + | | | channels[0:1]: 0x291.5-0x298.7 (7.3) + | | | [0]{}: channel 0x291.5-0x298.7 (7.3) +0x290| 01 81 15 | ... | part2_3_length: 770 0x291.5-0x293 (1.4) +0x290| 15 66 | .f | big_values: 85 0x293.1-0x294.1 (1.1) +0x290| 66 23 | f# | global_gain: 152 0x294.2-0x295.1 (1) +0x290| 23 | # | scalefac_compress: 8 0x295.2-0x295.5 (0.4) +0x290| 23 | # | blocksplit_flag: 1 0x295.6-0x295.6 (0.1) +0x290| 23 3a | #: | block_type: "3 short windows" (2) 0x295.7-0x296 (0.2) +0x290| 3a | : | switch_point: 0 0x296.1-0x296.1 (0.1) +0x290| 3a | : | table_select0: 29 0x296.2-0x296.6 (0.5) +0x290| 3a d0 | :. | table_select1: 13 0x296.7-0x297.3 (0.5) +0x290| d0 | . | subblock_gain0: 0 0x297.4-0x297.6 (0.3) +0x290| d0 00 | .. | subblock_gain1: 0 0x297.7-0x298.1 (0.3) +0x290| 00 | . | subblock_gain2: 0 0x298.2-0x298.4 (0.3) +0x290| 00 | . | preflag: 0 0x298.5-0x298.5 (0.1) +0x290| 00 | . | scalefac_scale: 0 0x298.6-0x298.6 (0.1) +0x290| 00 | . | count1table_select: 0 0x298.7-0x298.7 (0.1) +0x290| 07 aa c3 8e 33 85 d3| ....3..| data: raw bits 0x299-0x353.7 (187) +0x2a0|64 f1 a1 c1 08 1c 58 1f 5e 1f 18 1c 46 04 1e 89|d.....X.^...F...| +* |until 0x353.7 (187) | | + | | | other_data: raw bits 0x354-NA (0) + | | | crc_calculated: "2e0a" (raw bits) 0x354-NA (0) + | | | [1]{}: sample (mp3_frame) 0x354-0x424.7 (209) + | | | header{}: 0x354-0x357.7 (4) +0x350| ff fb | .. | sync: 0b11111111111 (valid) 0x354-0x355.2 (1.3) +0x350| fb | . | mpeg_version: "1" (3) (MPEG Version 1) 0x355.3-0x355.4 (0.2) +0x350| fb | . | layer: 3 (1) (MPEG Layer 3) 0x355.5-0x355.6 (0.2) + | | | sample_count: 1152 0x355.7-NA (0) +0x350| fb | . | protection_absent: true (No CRC) 0x355.7-0x355.7 (0.1) +0x350| 52 | R | bitrate: 64000 (5) 0x356-0x356.3 (0.4) +0x350| 52 | R | sample_rate: 44100 (0) 0x356.4-0x356.5 (0.2) +0x350| 52 | R | padding: "Padded" (0b1) 0x356.6-0x356.6 (0.1) +0x350| 52 | R | private: 0 0x356.7-0x356.7 (0.1) +0x350| c4 | . | channels: "Mono" (0b11) 0x357-0x357.1 (0.2) +0x350| c4 | . | channel_mode: "None" (0b0) 0x357.2-0x357.3 (0.2) +0x350| c4 | . | copyright: 0 0x357.4-0x357.4 (0.1) +0x350| c4 | . | original: 1 0x357.5-0x357.5 (0.1) +0x350| c4 | . | emphasis: "None" (0b0) 0x357.6-0x357.7 (0.2) + | | | side_info{}: 0x358-0x368.7 (17) +0x350| 04 82 | .. | main_data_end: 9 0x358-0x359 (1.1) +0x350| 82 | . | private_bits: 0 0x359.1-0x359.5 (0.5) +0x350| 82 0a | .. | share0: 8 0x359.6-0x35a.1 (0.4) + | | | granules[0:2]: 0x35a.2-0x368.7 (14.6) + | | | [0]{}: granule 0x35a.2-0x361.4 (7.3) + | | | channels[0:1]: 0x35a.2-0x361.4 (7.3) + | | | [0]{}: channel 0x35a.2-0x361.4 (7.3) +0x350| 0a 60 | .` | part2_3_length: 664 0x35a.2-0x35b.5 (1.4) +0x350| 60 21 | `! | big_values: 16 0x35b.6-0x35c.6 (1.1) +0x350| 21 10 | !. | global_gain: 136 0x35c.7-0x35d.6 (1) +0x350| 10 bd | .. | scalefac_compress: 5 0x35d.7-0x35e.2 (0.4) +0x350| bd | . | blocksplit_flag: 1 0x35e.3-0x35e.3 (0.1) +0x350| bd | . | block_type: "end" (3) 0x35e.4-0x35e.5 (0.2) +0x350| bd | . | switch_point: 0 0x35e.6-0x35e.6 (0.1) +0x350| bd f1| ..| table_select0: 31 0x35e.7-0x35f.3 (0.5) +0x350| f1| .| table_select1: 2 0x35f.4-0x360 (0.5) +0x360|00 |. | +0x360|00 |. | subblock_gain0: 0 0x360.1-0x360.3 (0.3) +0x360|00 |. | subblock_gain1: 0 0x360.4-0x360.6 (0.3) +0x360|00 01 |.. | subblock_gain2: 0 0x360.7-0x361.1 (0.3) +0x360| 01 | . | preflag: 0 0x361.2-0x361.2 (0.1) +0x360| 01 | . | scalefac_scale: 0 0x361.3-0x361.3 (0.1) +0x360| 01 | . | count1table_select: 0 0x361.4-0x361.4 (0.1) + | | | [1]{}: granule 0x361.5-0x368.7 (7.3) + | | | channels[0:1]: 0x361.5-0x368.7 (7.3) + | | | [0]{}: channel 0x361.5-0x368.7 (7.3) +0x360| 01 59 04 | .Y. | part2_3_length: 690 0x361.5-0x363 (1.4) +0x360| 04 a1 | .. | big_values: 18 0x363.1-0x364.1 (1.1) +0x360| a1 e2 | .. | global_gain: 135 0x364.2-0x365.1 (1) +0x360| e2 | . | scalefac_compress: 8 0x365.2-0x365.5 (0.4) +0x360| e2 | . | blocksplit_flag: 1 0x365.6-0x365.6 (0.1) +0x360| e2 be | .. | block_type: "start block" (1) 0x365.7-0x366 (0.2) +0x360| be | . | switch_point: 0 0x366.1-0x366.1 (0.1) +0x360| be | . | table_select0: 31 0x366.2-0x366.6 (0.5) +0x360| be 20 | . | table_select1: 2 0x366.7-0x367.3 (0.5) +0x360| 20 | | subblock_gain0: 0 0x367.4-0x367.6 (0.3) +0x360| 20 00 | . | subblock_gain1: 0 0x367.7-0x368.1 (0.3) +0x360| 00 | . | subblock_gain2: 0 0x368.2-0x368.4 (0.3) +0x360| 00 | . | preflag: 0 0x368.5-0x368.5 (0.1) +0x360| 00 | . | scalefac_scale: 0 0x368.6-0x368.6 (0.1) +0x360| 00 | . | count1table_select: 0 0x368.7-0x368.7 (0.1) +0x360| 01 d9 81 38 05 c9 80| ...8...| data: raw bits 0x369-0x41a.7 (178) +0x370|20 04 f1 80 8e 07 01 96 d2 b0 19 91 ec 2a 39 85| ............*9.| +* |until 0x41a.7 (178) | | +0x410| 85 | . | padding_byte: raw bits 0x41b-0x41b.7 (1) +0x410| 62 08 3d a0| b.=.| other_data: raw bits 0x41c-0x424.7 (9) +0x420|52 36 7f 26 17 |R6.&. | + | | | crc_calculated: "9950" (raw bits) 0x425-NA (0) + | | | [2]{}: sample (mp3_frame) 0x425-0x4f5.7 (209) + | | | header{}: 0x425-0x428.7 (4) +0x420| ff fb | .. | sync: 0b11111111111 (valid) 0x425-0x426.2 (1.3) +0x420| fb | . | mpeg_version: "1" (3) (MPEG Version 1) 0x426.3-0x426.4 (0.2) +0x420| fb | . | layer: 3 (1) (MPEG Layer 3) 0x426.5-0x426.6 (0.2) + | | | sample_count: 1152 0x426.7-NA (0) +0x420| fb | . | protection_absent: true (No CRC) 0x426.7-0x426.7 (0.1) +0x420| 52 | R | bitrate: 64000 (5) 0x427-0x427.3 (0.4) +0x420| 52 | R | sample_rate: 44100 (0) 0x427.4-0x427.5 (0.2) +0x420| 52 | R | padding: "Padded" (0b1) 0x427.6-0x427.6 (0.1) +0x420| 52 | R | private: 0 0x427.7-0x427.7 (0.1) +0x420| c4 | . | channels: "Mono" (0b11) 0x428-0x428.1 (0.2) +0x420| c4 | . | channel_mode: "None" (0b0) 0x428.2-0x428.3 (0.2) +0x420| c4 | . | copyright: 0 0x428.4-0x428.4 (0.1) +0x420| c4 | . | original: 1 0x428.5-0x428.5 (0.1) +0x420| c4 | . | emphasis: "None" (0b0) 0x428.6-0x428.7 (0.2) + | | | side_info{}: 0x429-0x439.7 (17) +0x420| 0d 80 | .. | main_data_end: 27 0x429-0x42a (1.1) +0x420| 80 | . | private_bits: 0 0x42a.1-0x42a.5 (0.5) +0x420| 80 0d | .. | share0: 0 0x42a.6-0x42b.1 (0.4) + | | | granules[0:2]: 0x42b.2-0x439.7 (14.6) + | | | [0]{}: granule 0x42b.2-0x432.4 (7.3) + | | | channels[0:1]: 0x42b.2-0x432.4 (7.3) + | | | [0]{}: channel 0x42b.2-0x432.4 (7.3) +0x420| 0d e4 | .. | part2_3_length: 889 0x42b.2-0x42c.5 (1.4) +0x420| e4 c9 | .. | big_values: 100 0x42c.6-0x42d.6 (1.1) +0x420| c9 7b | .{ | global_gain: 189 0x42d.7-0x42e.6 (1) +0x420| 7b f9| {.| scalefac_compress: 15 0x42e.7-0x42f.2 (0.4) +0x420| f9| .| blocksplit_flag: 1 0x42f.3-0x42f.3 (0.1) +0x420| f9| .| block_type: "3 short windows" (2) 0x42f.4-0x42f.5 (0.2) +0x420| f9| .| switch_point: 0 0x42f.6-0x42f.6 (0.1) +0x420| f9| .| table_select0: 24 0x42f.7-0x430.3 (0.5) +0x430|89 |. | +0x430|89 84 |.. | table_select1: 19 0x430.4-0x431 (0.5) +0x430| 84 | . | subblock_gain0: 0 0x431.1-0x431.3 (0.3) +0x430| 84 | . | subblock_gain1: 2 0x431.4-0x431.6 (0.3) +0x430| 84 91 | .. | subblock_gain2: 2 0x431.7-0x432.1 (0.3) +0x430| 91 | . | preflag: 0 0x432.2-0x432.2 (0.1) +0x430| 91 | . | scalefac_scale: 1 0x432.3-0x432.3 (0.1) +0x430| 91 | . | count1table_select: 0 0x432.4-0x432.4 (0.1) + | | | [1]{}: granule 0x432.5-0x439.7 (7.3) + | | | channels[0:1]: 0x432.5-0x439.7 (7.3) + | | | [0]{}: channel 0x432.5-0x439.7 (7.3) +0x430| 91 30 8d | .0. | part2_3_length: 609 0x432.5-0x434 (1.4) +0x430| 8d a3 | .. | big_values: 54 0x434.1-0x435.1 (1.1) +0x430| a3 03 | .. | global_gain: 140 0x435.2-0x436.1 (1) +0x430| 03 | . | scalefac_compress: 0 0x436.2-0x436.5 (0.4) +0x430| 03 | . | blocksplit_flag: 1 0x436.6-0x436.6 (0.1) +0x430| 03 b2 | .. | block_type: "end" (3) 0x436.7-0x437 (0.2) +0x430| b2 | . | switch_point: 0 0x437.1-0x437.1 (0.1) +0x430| b2 | . | table_select0: 25 0x437.2-0x437.6 (0.5) +0x430| b2 f0 | .. | table_select1: 15 0x437.7-0x438.3 (0.5) +0x430| f0 | . | subblock_gain0: 0 0x438.4-0x438.6 (0.3) +0x430| f0 00 | .. | subblock_gain1: 0 0x438.7-0x439.1 (0.3) +0x430| 00 | . | subblock_gain2: 0 0x439.2-0x439.4 (0.3) +0x430| 00 | . | preflag: 0 0x439.5-0x439.5 (0.1) +0x430| 00 | . | scalefac_scale: 0 0x439.6-0x439.6 (0.1) +0x430| 00 | . | count1table_select: 0 0x439.7-0x439.7 (0.1) +0x430| 53 ca 1e 59 fd 29| S..Y.)| data: raw bits 0x43a-0x4d9.7 (160) +0x440|ba 0b 84 d4 8a f8 8d cb a0 77 10 07 47 8b 8c 7b|.........w..G..{| +* |until 0x4d9.7 (160) | | +0x4d0| 6a | j | padding_byte: raw bits 0x4da-0x4da.7 (1) +0x4d0| 4c 41 4d 45 33| LAME3| other_data: raw bits 0x4db-0x4f5.7 (27) +0x4e0|2e 31 30 30 aa aa aa aa aa aa aa aa aa aa aa aa|.100............| +0x4f0|aa aa aa aa aa aa |...... | + | | | crc_calculated: "c36b" (raw bits) 0x4f6-NA (0) diff --git a/format/mp4/testdata/stz2.mp4 b/format/mp4/testdata/stz2.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..6bffedc84995969d29b2ef6e9660bedee3d84d64 GIT binary patch literal 1328 zcmZQzU=T?wsVvAW&d+6FU|@vMOc}ZP`DH+UPHtI73Xo>Fr?$}(gc%r^UjVsA42(d< zAPE>i;Q$5E_zp02*l8x9uxMs}N-;=UfStkr|Nnpg{{v0AUs9Bq4HSzh$p$-w8KeN> z5V#daATcOl1lx;dIb0=FkpoOMgjPvSDFIn5lbTap0+j-p05q2+5TchcJU1mX5h$jR zn*s?CkUEGv*0?Y*@VpB>0uo`+%}B{90<(ZbaeiqYj18iLf&3JY#JrT8RFE1*rrgZD zG$2EuI2U0kkgt*g5tm6RN(IS-0LVc+rA0XkQ1-FnlB66UJG{807#u@TarfK;6Ocne z0Hg;3m>2{=43JZSKsmJ-64K0~KpqQkHjui=z{s)ygxMHDk)cpr0uB?9au6SgSsH*e z&`9QYKw1W9Z8DGs0gyEy42l~NEnZww1&b37kobj*7lD*WaY=GMkOl#uGNu+FuF6eG zEcyRC02p{&I?j5bQyLf>Mbnh6E-qYUe zuolk#@FO8WgoT-@$%V%+)>ZU1sRUx2`Db(U|tX?_rzJBbTcGPdX=7>`99K|LG-=?kw5;$3>LY#eM&SRSZEJ z8!Q-aHrV|C9dv}Hi7P=-VDCo;#z>ZhkM=1rFy3smU_IHO!1A%7kDYPar45o3-)LF3 z7Vw^In!s+^sK)xRF^E;Mv4|zGA&D`B*PXBF+|`-O<5zWARDW9ge{I=c(~MVtUmpAa z|2-4ug92tXh83J?tR5n1%mNy1oF4++N++#bmXdKkP5OpU8s7|QH5Ln{W$ZJg)7T>< zpD}i@zg+kEu$Yd_;#SFPg;6W+Px}4g@7*nGM!Y}fTn%Ycbtc|aL^LA!kK zfdc^y%r{$;IBXXLnboU_gFM9B!29H6_0P_hi3YuknKyl42tFkj`B!rncgvNoAHAm+ zlnb!CclT85H5oG=IlwYsWXEN_K7;KG*aV_DrtAw(F51m{n0=AXgCDKsU+%q^e8}0h z;)le;@Be=~ED1KSNQ?QuLPl^76YB}n2Nn;^E{JjLTW0ud(X)x!d?{MFMj3o7!j07; zgf2}=s?yW&VJ#{8WvjL9YEFdzx