mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-28 22:24:34 +01:00
remove duplicated MOOV bpces
This commit is contained in:
parent
3fac07c04a
commit
099db78935
1 changed files with 15 additions and 0 deletions
|
@ -24,7 +24,22 @@ class MP4FixupTimestampPP(PostProcessor):
|
||||||
""" returns (baseMediaDecodeTime offset, sample duration cutoff) """
|
""" returns (baseMediaDecodeTime offset, sample duration cutoff) """
|
||||||
smallest_bmdt, known_sdur = inf, set()
|
smallest_bmdt, known_sdur = inf, set()
|
||||||
with open(filepath, 'rb') as r:
|
with open(filepath, 'rb') as r:
|
||||||
|
moov_over, in_secondary_moov = False, False
|
||||||
for btype, content in parse_mp4_boxes(r):
|
for btype, content in parse_mp4_boxes(r):
|
||||||
|
# skip duplicate MOOV boxes
|
||||||
|
if btype == 'moov':
|
||||||
|
if moov_over:
|
||||||
|
in_secondary_moov = True
|
||||||
|
continue
|
||||||
|
elif btype is None and content == 'moov':
|
||||||
|
in_secondary_moov = False
|
||||||
|
|
||||||
|
if moov_over:
|
||||||
|
continue
|
||||||
|
moov_over = True
|
||||||
|
elif in_secondary_moov:
|
||||||
|
continue
|
||||||
|
|
||||||
if btype == 'tfdt':
|
if btype == 'tfdt':
|
||||||
version, _ = unpack_ver_flags(content[0:4])
|
version, _ = unpack_ver_flags(content[0:4])
|
||||||
# baseMediaDecodeTime always comes to the first
|
# baseMediaDecodeTime always comes to the first
|
||||||
|
|
Loading…
Reference in a new issue