From a092982c4a3b44db63a4f1409c066ee12c8f97dd Mon Sep 17 00:00:00 2001 From: WorldObservationLog Date: Tue, 28 May 2024 22:55:23 +0800 Subject: [PATCH] fix: shell execute problem on Linux and macOS when calling ffmpeg --- src/mp4.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mp4.py b/src/mp4.py index 33388c0..7251515 100644 --- a/src/mp4.py +++ b/src/mp4.py @@ -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()