From 623eb250fec1653d270e140597d41858d4434e13 Mon Sep 17 00:00:00 2001 From: zackees Date: Sun, 28 Apr 2024 19:29:13 -0700 Subject: [PATCH] Update version to 2.7.35 & use static_ffmpeg commands --- README.md | 1 + setup.py | 2 +- transcribe_anything/api.py | 6 +----- transcribe_anything/audio.py | 7 ++----- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 525b003..a94ad93 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,7 @@ is closed then to get back into the environment `cd transcribe_anything` and exe * Every commit is tested for standard linters and a batch of unit tests. # Versions + * 2.7.35: All `ffmpeg` commands are now `static_ffmpeg` commands. Fixes issue. * 2.7.34: Various fixes. * 2.7.33: Fixes linux * 2.7.32: Fixes mac m1 and m2. diff --git a/setup.py b/setup.py index 8077a6e..65a3672 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ EMAIL = "dont@email.me" AUTHOR = "Zach Vorhies" REQUIRES_PYTHON = ">=3.10.0" -VERSION = "2.7.34" +VERSION = "2.7.35" # The text of the README file with open(os.path.join(HERE, "README.md"), encoding="utf-8", mode="r") as fd: diff --git a/transcribe_anything/api.py b/transcribe_anything/api.py index 8c29f16..a827a3b 100644 --- a/transcribe_anything/api.py +++ b/transcribe_anything/api.py @@ -20,7 +20,6 @@ from typing import Optional from appdirs import user_config_dir # type: ignore -from static_ffmpeg import add_paths as ffmpeg_add_paths # type: ignore from transcribe_anything.audio import fetch_audio from transcribe_anything.insanely_fast_whisper import run_insanely_fast_whisper @@ -77,9 +76,6 @@ def from_str(device: str) -> "Device": raise ValueError(f"Unknown device {device}") -ffmpeg_add_paths() - - def make_temp_wav() -> str: """ Makes a temporary mp3 file and returns the path to it. @@ -293,7 +289,7 @@ def transcribe( assert os.path.isfile(url_or_file), f"Path {url_or_file} doesn't exist." out_mp4 = os.path.join(output_dir, "out.mp4") embed_ffmpeg_cmd_list = [ - "ffmpeg", + "static_ffmpeg", "-y", "-i", url_or_file, diff --git a/transcribe_anything/audio.py b/transcribe_anything/audio.py index 6e78f49..4a6cb71 100644 --- a/transcribe_anything/audio.py +++ b/transcribe_anything/audio.py @@ -8,8 +8,6 @@ import sys import tempfile -import static_ffmpeg # type: ignore - from transcribe_anything.util import PROCESS_TIMEOUT from transcribe_anything.ytldp_download import ytdlp_download @@ -27,7 +25,7 @@ def _convert_to_wav( tmpwav.close() tmpwavepath = tmpwav.name audio_encoder = "-acodec pcm_s16le -ar 44100 -ac 1" - cmd = f'ffmpeg -y -i "{inpath}" {cmd_audio_filter} {audio_encoder} "{tmpwavepath}"' + cmd = f'static_ffmpeg -y -i "{inpath}" {cmd_audio_filter} {audio_encoder} "{tmpwavepath}"' print(f"Running:\n {cmd}") try: subprocess.run( @@ -48,7 +46,6 @@ def _convert_to_wav( def fetch_audio(url_or_file: str, out_wav: str) -> None: """Fetches from the internet or from a local file and outputs a wav file.""" assert out_wav.endswith(".wav") - static_ffmpeg.add_paths() # pylint: disable=no-member if url_or_file.startswith("http") or url_or_file.startswith("ftp"): with tempfile.TemporaryDirectory() as tmpdir: print(f"Using temporary directory {tmpdir}") @@ -62,7 +59,7 @@ def fetch_audio(url_or_file: str, out_wav: str) -> None: abspath = os.path.abspath(url_or_file) out_wav_abs = os.path.abspath(out_wav) with tempfile.TemporaryDirectory() as tmpdir: - cmd = f'ffmpeg -y -i "{abspath}" -acodec pcm_s16le -ar 44100 -ac 1 out.wav' + cmd = f'static_ffmpeg -y -i "{abspath}" -acodec pcm_s16le -ar 44100 -ac 1 out.wav' sys.stderr.write(f"Running:\n {cmd}\n") subprocess.run( cmd,