-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
26 lines (25 loc) · 818 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import mp4
with open("s.mp4", "rb") as f:
while True:
try:
box = mp4.Box()
box.size = int.from_bytes(f.read(4))
box.name = f.read(4).decode()
if box.size == 0:
break
print(box.size, box.name)
except UnicodeDecodeError:
print("Error!")
# break
f.read(box.size)
continue
if box.name == "ftyp":
handled: mp4.FileTypeBox = mp4.hadle_ftyp(box, f)
print("Handled",handled.name)
elif box.name == "moov":
print("!! moov detected !!")
handled: mp4.MoovBox = mp4.handle_moov(box, f)
print("Handled",handled.name)
else:
print("Cant handle", box.name, "box")
f.read(box.size-8)