From cf56f20a33bdbe062cb17e776291eb4087327909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C=E8=A7=82=E5=AF=9F=E6=97=A5=E5=BF=97?= Date: Mon, 14 Jul 2025 22:55:46 +0800 Subject: [PATCH] fix: correct MP4Box command name --- src/mp4.py | 6 +++--- src/utils.py | 2 +- tools/install-deps.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mp4.py b/src/mp4.py index 0ef555d..c6df5a2 100644 --- a/src/mp4.py +++ b/src/mp4.py @@ -88,7 +88,7 @@ def extract_song(raw_song: bytes, codec: str) -> SongInfo: subprocess.run(f"gpac -i {raw_mp4.absolute()} nhmlw:pckp=true -o {nhml_name}", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell()) xml_name = (Path(tmp_dir.name) / Path(mp4_name).with_suffix('.xml')).absolute() - subprocess.run(f"mp4box -diso {raw_mp4.absolute()} -out {xml_name}", + subprocess.run(f"MP4Box -diso {raw_mp4.absolute()} -out {xml_name}", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell()) decoder_params = None @@ -193,7 +193,7 @@ def encapsulate(song_info: SongInfo, decrypted_media: bytes, atmos_convent: bool subprocess.run(f"gpac -i {nhml_name.absolute()} nhmlr -o {song_name.absolute()}", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell()) if not if_raw_atmos(song_info.codec, atmos_convent): - subprocess.run(f'mp4box -brand "M4A " -ab "M4A " -ab "mp42" {song_name.absolute()}', + subprocess.run(f'MP4Box -brand "M4A " -ab "M4A " -ab "mp42" {song_name.absolute()}', stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell()) with open(song_name.absolute(), "rb") as f: final_song = f.read() @@ -208,7 +208,7 @@ def write_metadata(song: bytes, metadata: SongMetadata, embed_metadata: list[str song_name = Path(tmp_dir.name) / Path(f"{name}.m4a") with open(song_name.absolute(), "wb") as f: f.write(song) - subprocess.run(["mp4box", + subprocess.run(["MP4Box", "-time", params.get("CreationTime").strftime("%d/%m/%Y-%H:%M:%S"), "-mtime", params.get("ModificationTime").strftime("%d/%m/%Y-%H:%M:%S"), "-keep-utc", "-name", f"1={metadata.title}", "-itags", "tool=", song_name.absolute()], diff --git a/src/utils.py b/src/utils.py index 96bef03..f296c80 100644 --- a/src/utils.py +++ b/src/utils.py @@ -212,7 +212,7 @@ def convent_mac_timestamp_to_datetime(timestamp: int): def check_dep(): - for dep in ["ffmpeg", "gpac", "mp4box", "mp4edit", "mp4extract"]: + for dep in ["ffmpeg", "gpac", "MP4Box", "mp4edit", "mp4extract"]: try: subprocess.run(dep, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) except FileNotFoundError: diff --git a/tools/install-deps.sh b/tools/install-deps.sh index 691854d..79169f3 100755 --- a/tools/install-deps.sh +++ b/tools/install-deps.sh @@ -20,7 +20,7 @@ if ! command -v ffmpeg >/dev/null 2>&1; then $PREFIX apt-get install -y ffmpeg fi -if ! command -v mp4box >/dev/null 2>&1; then +if ! command -v MP4Box >/dev/null 2>&1; then echo "Installing gpac and MP4Box..." cd /tmp/ || exit 1 git clone --depth=1 https://github.com/gpac/gpac.git