Skip to content

Commit

Permalink
fix: missing tmp_dir.cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldObservationLog committed May 18, 2024
1 parent afd1213 commit b38949d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ def fix_encapsulate(song: bytes) -> bytes:
subprocess.run(["ffmpeg", "-y", "-i", song_name.absolute(), "-fflags", "+bitexact", "-c:a", "copy", "-c:v", "copy",
new_song_name.absolute()], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
with open(new_song_name.absolute(), "rb") as f:
return f.read()
encapsulated_song = f.read()
tmp_dir.cleanup()
return encapsulated_song


# FFMPEG will overwrite maxBitrate in DecoderConfigDescriptor
Expand All @@ -231,4 +233,6 @@ def fix_esds_box(raw_song: bytes, song: bytes) -> bytes:
subprocess.run(f"mp4edit --replace moov/trak/mdia/minf/stbl/stsd/mp4a/esds:{esds_name.absolute()} {song_name.absolute()} {final_song_name.absolute()}",
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
with open(final_song_name.absolute(), "rb") as f:
return f.read()
final_song = f.read()
tmp_dir.cleanup()
return final_song

0 comments on commit b38949d

Please sign in to comment.