Skip to content
This repository was archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
fix: shell execute problem on Linux and macOS when calling ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldObservationLog committed May 28, 2024
1 parent 35a520f commit a092982
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ async def fix_encapsulate(song: bytes) -> bytes:
new_song_name = Path(tmp_dir.name) / Path(f"{name}_fixed.m4a")
with open(song_name.absolute(), "wb") as f:
f.write(song)
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, shell=if_shell())
subprocess.run(f"ffmpeg -y -i {song_name.absolute()} -fflags +bitexact -c:a copy -c:v copy {new_song_name.absolute()}",
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell())
with open(new_song_name.absolute(), "rb") as f:
encapsulated_song = f.read()
tmp_dir.cleanup()
Expand Down

0 comments on commit a092982

Please sign in to comment.