def test_vmhd_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:16, uintbe:16, uintbe:16, uintbe:16", 20, b"vmhd", 0, b"\x00\x00\x01", 0, 0, 0, 0) box_header = FullBoxHeader() vmhd = bx_def.VMHD(box_header) vmhd.header.type = b"vmhd" vmhd.header.version = 0 vmhd.header.flags = b"\x00\x00\x01" vmhd.graphicsmode = 0 vmhd.opcolor = [0, 0, 0] vmhd.refresh_box_size() box = vmhd assert box.header.type == b"vmhd" assert box.header.box_size == 20 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x01" assert box.graphicsmode == 0 assert box.opcolor == [0, 0, 0] assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def test_mett_box(): bs = pack("uintbe:32, bytes:4, " "uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, " "uintbe:16, " "bytes:1, bytes:11", 28, b"mett", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 1, b'\0', b'image/heif\0') box_header = BoxHeader() mett = bx_def.METT(box_header) mett.header.type = b"mett" mett.data_reference_index = 1 mett.content_encoding = b'\0' mett.mime_format = b'image/heif\0' mett.refresh_box_size() box = mett assert box.header.type == b"mett" assert box.header.box_size == 28 assert box.data_reference_index == 1 assert box.content_encoding == b'\0' assert box.mime_format == b'image/heif\0' assert len(box.boxes) == 0 assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def test_clap_box(): bs = pack("uintbe:32, bytes:4, " "uintbe:32, uintbe:32, uintbe:32, uintbe:32, " "intbe:32, uintbe:32, intbe:32, uintbe:32", 40, b"clap", 500, 1, 333, 1, -12, 2, -179, 2) box_header = Parser.parse_header(bs) clap = bx_def.CLAP.parse_box(bs, box_header) box = clap assert box.header.start_pos == 0 assert box.header.type == b"clap" assert box.header.box_size == 40 assert box.clean_aperture_width_n == 500 assert box.clean_aperture_width_d == 1 assert box.clean_aperture_height_n == 333 assert box.clean_aperture_height_d == 1 assert box.horiz_off_n == -12 assert box.horiz_off_d == 2 assert box.vert_off_n == -179 assert box.vert_off_d == 2 assert bytes(box) == bs.bytes
def test_stts_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32", 24, b"stts", 0, b"\x00\x00\x00", 1, 1, 1) box_header = FullBoxHeader() stts = bx_def.STTS(box_header) stts.header.type = b"stts" stts.header.version = 0 stts.header.flags = b"\x00\x00\x00" entry = stts.append_and_return() entry.sample_count = 1 entry.sample_delta = 1 stts.refresh_box_size() box = stts assert box.header.type == b"stts" assert box.header.box_size == 24 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.entry_count == 1 assert len(box.entries) == 1 assert box.entries[0].sample_count == 1 assert box.entries[0].sample_delta == 1 parsed_box = next(Parser.parse(bs)) parsed_box.load(bs) assert bytes(parsed_box) == bs.bytes assert bytes(box) == bs.bytes
def test_stsz_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32", 24, b"stsz", 0, b"\x00\x00\x00", 0, 1, 1) box_header = FullBoxHeader() stsz = bx_def.STSZ(box_header) stsz.header.type = b"stsz" stsz.header.version = 0 stsz.header.flags = b"\x00\x00\x00" stsz.sample_size = 0 sample = stsz.append_and_return() sample.entry_size = 1 stsz.refresh_box_size() box = stsz assert box.header.type == b"stsz" assert box.header.box_size == 24 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.sample_size == 0 assert box.sample_count == 1 assert len(box.samples) == 1 assert box.samples[0].entry_size == 1 parsed_box = next(Parser.parse(bs)) parsed_box.load(bs) assert bytes(parsed_box) == bs.bytes assert bytes(box) == bs.bytes
def test_ctts_box_v1(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, intbe:32", 24, b"ctts", 1, b"\x00\x00\x00", 1, 1, -1) box_header = FullBoxHeader() ctts = bx_def.CTTS(box_header) ctts.header.type = b"ctts" ctts.header.version = 1 ctts.header.flags = b"\x00\x00\x00" entry = ctts.append_and_return() entry.sample_count = 1 entry.sample_offset = (-1, "intbe:32") ctts.refresh_box_size() box = ctts assert box.header.type == b"ctts" assert box.header.box_size == 24 assert box.header.version == 1 assert box.header.flags == b"\x00\x00\x00" assert box.entry_count == 1 assert len(box.entries) == 1 assert box.entries[0].sample_count == 1 assert box.entries[0].sample_offset == -1 parsed_box = next(Parser.parse(bs)) parsed_box.load(bs) assert bytes(parsed_box) == bs.bytes assert bytes(box) == bs.bytes
def test_co64_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:64, uintbe:64, uintbe:64", 40, b"co64", 0, b"\x00\x00\x00", 3, 0, 1, 2) box_header = Parser.parse_header(bs) stco = bx_def.CO64.parse_box(bs, box_header) box = stco assert box.header.start_pos == 0 assert box.header.type == b"co64" assert box.header.box_size == 40 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.entry_count == 3 assert len(box.entries) == 0 box.load(bs) assert len(box.entries) == 3 assert box.entries[0].chunk_offset == 0 assert box.entries[1].chunk_offset == 1 assert box.entries[2].chunk_offset == 2 assert bytes(box) == bs.bytes
def test_mvhd_box_v1(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:64, uintbe:64, uintbe:32, uintbe:64, " "uintbe:16, uintbe:16, uintbe:8, uintbe:8, " "bits:16, bits:32, bits:32, " "uintbe:32, uintbe:32, uintbe:32, uintbe:32, uintbe:32, uintbe:32, uintbe:32, uintbe:32, uintbe:32, " "bits:32, bits:32, bits:32, bits:32, bits:32, bits:32, " "uintbe:32", 120, b"mvhd", 1, b"\x00\x00\x00", 3596199850, 3596199850, 48000, 6720608, 1, 0, 1, 0, b"\x00" * 2, b"\x00" * 4, b"\x00" * 4, 65536, 0, 0, 0, 65536, 0, 0, 0, 1073741824, b"\x00" * 4, b"\x00" * 4, b"\x00" * 4, b"\x00" * 4, b"\x00" * 4, b"\x00" * 4, 3) box_header = FullBoxHeader() mvhd = bx_def.MVHD(box_header) mvhd.header.type = b"mvhd" mvhd.header.version = 1 mvhd.header.flags = b"\x00\x00\x00" mvhd.creation_time = 3596199850 mvhd.modification_time = 3596199850 mvhd.timescale = 48000 mvhd.duration = 6720608 mvhd.rate = [1, 0] mvhd.volume = [1, 0] mvhd.matrix = [65536, 0, 0, 0, 65536, 0, 0, 0, 1073741824] mvhd.pre_defined = [b"\x00" * 4] * 6 mvhd.next_track_id = 3 mvhd.refresh_box_size() box = mvhd assert box.header.type == b"mvhd" assert box.header.box_size == 120 assert box.header.version == 1 assert box.header.flags == b"\x00\x00\x00" assert box.creation_time == 3596199850 assert box.modification_time == 3596199850 assert box.timescale == 48000 assert box.duration == 6720608 assert box.rate == [1, 0] assert box.volume == [1, 0] assert box.matrix == [65536, 0, 0, 0, 65536, 0, 0, 0, 1073741824] assert box.pre_defined == [b"\x00" * 4] * 6 assert box.next_track_id == 3 assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def test_stsz_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32", 24, b"stsz", 0, b"\x00\x00\x00", 0, 1, 1) box_header = Parser.parse_header(bs) stsz = bx_def.STSZ.parse_box(bs, box_header) box = stsz assert box.header.start_pos == 0 assert box.header.type == b"stsz" assert box.header.box_size == 24 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.sample_size == 0 assert box.sample_count == 1 assert len(box.samples) == 0 box.load(bs) assert len(box.samples) == 1 assert box.samples[0].entry_size == 1 assert bytes(box) == bs.bytes
def test_stsc_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32, uintbe:32", 28, b"stsc", 0, b"\x00\x00\x00", 1, 1, 1, 1) box_header = Parser.parse_header(bs) stsc = bx_def.STSC.parse_box(bs, box_header) box = stsc assert box.header.start_pos == 0 assert box.header.type == b"stsc" assert box.header.box_size == 28 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.entry_count == 1 assert len(box.entries) == 0 box.load(bs) assert len(box.entries) == 1 assert box.entries[0].first_chunk == 1 assert box.entries[0].samples_per_chunk == 1 assert box.entries[0].sample_description_index == 1 assert bytes(box) == bs.bytes
def test_ctts_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32", 24, b"ctts", 0, b"\x00\x00\x00", 1, 1, 1) box_header = Parser.parse_header(bs) ctts = bx_def.CTTS.parse_box(bs, box_header) box = ctts assert box.header.start_pos == 0 assert box.header.type == b"ctts" assert box.header.box_size == 24 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.entry_count == 1 assert len(box.entries) == 0 box.load(bs) assert len(box.entries) == 1 assert box.entries[0].sample_count == 1 assert box.entries[0].sample_offset == 1 assert bytes(box) == bs.bytes
def test_mdhd_header_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32, uintbe:32, " "bits:1, uint:5, uint:5, uint:5, bits:16", 32, b"mdhd", 0, b"\x00\x00\x00", 3596199850, 3596199850, 30000, 4200196, 0x1, 21, 14, 4, b"\x00" * 2) box_header = Parser.parse_header(bs) mdhd = parse.MDHD.parse_box(bs, box_header) box = mdhd assert box.header.start_pos == 0 assert box.header.type == b"mdhd" assert box.header.box_size == 32 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.creation_time == 3596199850 assert box.modification_time == 3596199850 assert box.timescale == 30000 assert box.duration == 4200196 assert box.language == [21, 14, 4] assert box.pre_defined == 0 assert bytes(box) == bs.bytes
def test_elst_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, uintbe:32, uintbe:32, uintbe:16, uintbe:16", 28, b"elst", 0, b"\x00\x00\x00", 1, 3000, 0, 1, 0) box_header = Parser.parse_header(bs) elst = bx_def.ELST.parse_box(bs, box_header) box = elst assert box.header.start_pos == 0 assert box.header.type == b"elst" assert box.header.box_size == 28 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.entry_count == 1 assert len(box.entries) == 0 box.load(bs) assert len(box.entries) == 1 assert box.entries[0].segment_duration == 3000 assert box.entries[0].media_time == 0 assert box.entries[0].media_rate_integer == 1 assert box.entries[0].media_rate_fraction == 0 assert bytes(box) == bs.bytes
def test_hdlr_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24, " "uintbe:32, bytes:4, bits:32, bits:32, bits:32, bytes:19", 51, b"hdlr", 0, b"\x00\x00\x00", 0, b"vide", b"\x00" * 4, b"\x00" * 4, b"\x00" * 4, b"Vireo Eyes v2.4.22\0") box_header = FullBoxHeader() hdlr = bx_def.HDLR(box_header) hdlr.header.type = b"hdlr" hdlr.header.version = 0 hdlr.header.flags = b"\x00\x00\x00" hdlr.pre_defined = 0 hdlr.handler_type = b"vide" hdlr.name = b"Vireo Eyes v2.4.22\0" hdlr.refresh_box_size() box = hdlr assert box.header.type == b"hdlr" assert box.header.box_size == 51 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert box.pre_defined == 0 assert box.handler_type == b"vide" assert box.name == b"Vireo Eyes v2.4.22\0" assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def test_sbtt_box(): bs = pack("uintbe:32, bytes:4, " "uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, " "uintbe:16, " "bytes:1, bytes:11", 28, b"sbtt", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 1, b'\0', b'text/plain\0') box_header = Parser.parse_header(bs) mett = bx_def.METT.parse_box(bs, box_header) box = mett assert box.header.start_pos == 0 assert box.header.type == b"sbtt" assert box.header.box_size == 28 assert box.data_reference_index == 1 assert box.content_encoding == b'\0' assert box.mime_format == b'text/plain\0' assert len(box.boxes) == 0 assert bytes(box) == bs.bytes
def test_ftyp_box_w_no_type(): bs = pack("uintbe:32, bytes:4, " "bytes:4, uintbe:32, bytes:8", 24, b"ftyp", b"bzna", 10, b"mp42mp41") box_header = BoxHeader() ftyp = bx_def.FTYP(box_header) ftyp.header.type = b"ftyp" ftyp.major_brand = (1652190817,) # b"bzna" ftyp.minor_version = (10,) ftyp.compatible_brands = ([1836069938, # b"mp42" 1836069937],) # b"mp41" ftyp.refresh_box_size() box = ftyp assert box.header.type == b"ftyp" assert box.header.box_size == 24 assert box.major_brand == 1652190817 # b"bzna" assert box.minor_version == 10 assert box.compatible_brands == [1836069938, # b"mp42" 1836069937] # b"mp41" assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def test_sbtt_box(): bs = pack("uintbe:32, bytes:4, " "uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, " "uintbe:16, " "bytes:1, bytes:11", 28, b"sbtt", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 1, b'\0', b'text/plain\0') box_header = BoxHeader() stxt = bx_def.STXT(box_header) stxt.header.type = b"sbtt" stxt.data_reference_index = 1 stxt.content_encoding = b'\0' stxt.mime_format = b'text/plain\0' stxt.refresh_box_size() box = stxt assert box.header.type == b"sbtt" assert box.header.box_size == 28 assert box.data_reference_index == 1 assert box.content_encoding == b'\0' assert box.mime_format == b'text/plain\0' assert len(box.boxes) == 0 assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def tune_video(filename, im_width, im_height): bstr = ConstBitStream(filename=filename) boxes = [box for box in Parser.parse(bstr)] # skip 'free' box boxes = boxes[:1] + boxes[2:] ftyp = boxes[0] mdat = boxes[1] moov = boxes[2] # pop 'udta' box moov.boxes.pop() trak = moov.boxes[-1] # remove edts mdia = trak.pop() trak.pop() trak.append(mdia) for box in boxes: box.load(bstr) box.refresh_box_size() ftyp.major_brand = 1769172845 # b"isom" ftyp.minor_version = 0 ftyp.compatible_brands = [1769172845] # b"isom" ftyp.refresh_box_size() # moov.trak.mdia.minf.stbl stbl = moov.boxes[-1].boxes[-1].boxes[-1].boxes[-1] # moov.trak.mdia.minf.stbl.stsd.hvc1 hvc1 = stbl.boxes[0].boxes[0] clap = bx_def.CLAP(BoxHeader()) clap.header.type = b"clap" clap.clean_aperture_width_n = im_width clap.clean_aperture_width_d = 1 clap.clean_aperture_height_n = im_height clap.clean_aperture_height_d = 1 clap.horiz_off_n = im_width - 512 clap.horiz_off_d = 2 clap.vert_off_n = im_height - 512 clap.vert_off_d = 2 # insert clap before pasp pasp = hvc1.pop() hvc1.append(clap) hvc1.append(pasp) stco = stbl.boxes[-1] stco.entries[ 0].chunk_offset = ftyp.header.box_size + mdat.header.header_size moov.refresh_box_size() return b''.join(bytes(box) for box in boxes)
def test_photo_heic_bytes(): bstr = ConstBitStream(filename="data/photo.heic") boxes = [box for box in Parser.parse(bstr)] assert b''.join([bytes(box) for box in boxes]) != bstr.bytes for box in boxes: box.load(bstr) assert b''.join([bytes(box) for box in boxes]) == bstr.bytes
def test_box_header(): bs = pack("uintbe:32, bytes:4", 100, b"abcd") box_header = Parser.parse_header(bs) assert box_header.start_pos == 0 assert box_header.type == b"abcd" assert box_header.box_size == 100 assert box_header.header_size == 8 assert box_header.content_size == 92 assert bytes(box_header) == bs.bytes
def test_box_header_extended(): bs = pack("uintbe:32, bytes:4, uintbe:64", 1, b"abcd", parse.MAX_UINT_32 + 1) box_header = Parser.parse_header(bs) assert box_header.start_pos == 0 assert box_header.type == b"abcd" assert box_header.box_size == parse.MAX_UINT_32 + 1 assert box_header.header_size == 16 assert box_header.content_size == parse.MAX_UINT_32 + 1 - 16 assert bytes(box_header) == bs.bytes
def test_video_bytes(): bstr = ConstBitStream(filename="tests/data/small_vid.mp4") boxes = [box for box in Parser.parse(bstr)] assert b''.join([bytes(box) for box in boxes]) != bstr.bytes for box in boxes: box.load(bstr) assert b''.join([bytes(box) for box in boxes]) == bstr.bytes
def test_box_header_extended_user_type(): bs = pack("uintbe:32, bytes:4, uintbe:64, bytes:16", 1, b"uuid", parse.MAX_UINT_32 + 1, b":benzina\x00\x00\x00\x00\x00\x00\x00\x00") box_header = Parser.parse_header(bs) assert box_header.start_pos == 0 assert box_header.type == b"uuid:benzina\x00\x00\x00\x00\x00\x00\x00\x00" assert box_header.box_size == parse.MAX_UINT_32 + 1 assert box_header.header_size == 32 assert box_header.content_size == parse.MAX_UINT_32 + 1 - 32 assert bytes(box_header) == bs.bytes
def test_box_header_user_type(): bs = pack("uintbe:32, bytes:4, bytes:16", 100, b"uuid", b":benzina\x00\x00\x00\x00\x00\x00\x00\x00") box_header = Parser.parse_header(bs) assert box_header.start_pos == 0 assert box_header.type == b"uuid:benzina\x00\x00\x00\x00\x00\x00\x00\x00" assert box_header.box_size == 100 assert box_header.header_size == 24 assert box_header.content_size == 76 assert bytes(box_header) == bs.bytes
def test_avc1_box(): bs = pack("uintbe:32, bytes:4, " "uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, uintbe:8, " "uintbe:16, " "uintbe:16, uintbe:16, uintbe:32, uintbe:32, uintbe:32, " "uintbe:16, uintbe:16, uintbe:16, uintbe:16, uintbe:16, uintbe:16, " "uintbe:32, " "uintbe:16, bytes:32, uintbe:16, " "intbe:16", 86, b"avc1", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 1, 0x0, 0x0, 0x0, 0x0, 0x0, 512, 512, 72, 0, 72, 0, 0x0, 1, b'\0' * 32, 24, -1) box_header = BoxHeader() avc1 = bx_def.AVC1(box_header) avc1.header.type = b"avc1" avc1.data_reference_index = 1 avc1.width = 512 avc1.height = 512 avc1.horizresolution = [72, 0] avc1.vertresolution = [72, 0] avc1.frame_count = 1 avc1.compressorname = b'\0' * 32 avc1.depth = 24 avc1.refresh_box_size() box = avc1 assert box.header.type == b"avc1" assert box.header.box_size == 86 assert box.data_reference_index == 1 assert box.width == 512 assert box.height == 512 assert box.horizresolution == [72, 0] assert box.vertresolution == [72, 0] assert box.frame_count == 1 assert box.compressorname == b'\0' * 32 assert box.depth == 24 assert len(box.boxes) == 0 assert bytes(next(Parser.parse(bs))) == bs.bytes assert bytes(box) == bs.bytes
def test_mdat_box_empty(): bs = pack("uintbe:32, bytes:4", 8, b"mdat") box_header = Parser.parse_header(bs) mdat = bx_def.MDAT.parse_box(bs, box_header) mdat.load(bs) box = mdat assert box.header.start_pos == 0 assert box.header.type == b"mdat" assert box.header.box_size == 8 assert box.data == b'' assert bytes(box) == bs.bytes
def test_nmhd_box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24", 12, b"nmhd", 0, b"\x00\x00\x00") box_header = Parser.parse_header(bs) nmhd = bx_def.NMHD.parse_box(bs, box_header) box = nmhd assert box.header.start_pos == 0 assert box.header.type == b"nmhd" assert box.header.box_size == 12 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x00" assert bytes(box) == bs.bytes
def test_pasp_box(): bs = pack("uintbe:32, bytes:4, uintbe:32, uintbe:32", 16, b"pasp", 150, 157) box_header = Parser.parse_header(bs) pasp = bx_def.PASP.parse_box(bs, box_header) box = pasp assert box.header.start_pos == 0 assert box.header.type == b"pasp" assert box.header.box_size == 16 assert box.h_spacing == 150 assert box.v_spacing == 157 assert bytes(box) == bs.bytes
def test_full_box_header(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24", 100, b"abcd", 1, b"\x00\x00\x07") box_header = Parser.parse_header(bs) full_box_header = parse.FullBoxHeader() full_box_header.extend_header(bs, box_header) del box_header assert full_box_header.start_pos == 0 assert full_box_header.type == b"abcd" assert full_box_header.box_size == 100 assert full_box_header.header_size == 12 assert full_box_header.content_size == 88 assert full_box_header.version == 1 assert full_box_header.flags == b"\x00\x00\x07" assert bytes(full_box_header) == bs.bytes
def test_url__box(): bs = pack("uintbe:32, bytes:4, uintbe:8, bits:24", 12, b"url ", 0, b"\x00\x00\x01") box_header = Parser.parse_header(bs) url_ = bx_def.URL_.parse_box(bs, box_header) box = url_ assert box.header.start_pos == 0 assert box.header.type == b"url " assert box.header.box_size == 12 assert box.header.version == 0 assert box.header.flags == b"\x00\x00\x01" assert box.location is None assert bytes(box) == bs.bytes