Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Use static-ffmpeg instead of installing ffmpeg #200

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Latest Binary
- Generated: 2024-01-30
- Git version: bbe1f4

[comment]: <> (Remove section for install of ffmpeg)
1. Install ffmpeg

First, install Chocolatey, a package manager for Windows.
Expand Down
2 changes: 2 additions & 0 deletions app/transcribe/app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from audio_player import AudioPlayer # noqa: E402 pylint: disable=C0413
from gpt_responder import InferenceResponderFactory, InferenceEnum
from audio_transcriber import WhisperCPPTranscriber, WhisperTranscriber, DeepgramTranscriber
import static_ffmpeg
sys.path.append('../..')
import interactions # noqa: E402 pylint: disable=C0413
from sdk import transcriber_models as tm # noqa: E402 pylint: disable=C0413
Expand Down Expand Up @@ -97,6 +98,7 @@ def initiate_app_threads(global_vars: TranscriptionGlobals,
def start_ffmpeg():
"""Start ffmpeg library"""
try:
static_ffmpeg.add_paths()
subprocess.run(["ffmpeg", "-version"], # nosec
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
Expand Down
3 changes: 2 additions & 1 deletion app/transcribe/audio_transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import wave
import tempfile
import pyaudiowpatch as pyaudio
import static_ffmpeg
sys.path.append('../..')
import conversation # noqa: E402 pylint: disable=C0413
import constants # noqa: E402 pylint: disable=C0413
Expand Down Expand Up @@ -215,7 +216,7 @@ def convert_wav_to_16khz_format(self, file_path: str) -> str:
try:
# Convert input file to 16khz. That is a requirement for using whisper.cpp
# ffmpeg -i <input audio filename> -ar 16000 -ac 1 -c:a pcm_s16le -y <output audio file>

static_ffmpeg.add_paths()
file_descritor, mod_file_path = tempfile.mkstemp(suffix=".wav")
os.close(file_descritor)
# print(f'Convert file {file_path} to 16khz file {mod_file_path}')
Expand Down
2 changes: 2 additions & 0 deletions app/transcribe/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def detect_ps():
return False
except FileNotFoundError:
print('Please install Powershell or ensure it is in path.')
# Remove comment about ffmpeg
print('Powershell is required to download models and install ffmpeg')
return False

Expand Down Expand Up @@ -148,6 +149,7 @@ def exec_ps(script: str) -> (bool, str):
return False, ''
except FileNotFoundError:
print('Please install Powershell or ensure it is in path.')
# Remove comment about ffmpeg
print('Powershell is required to download models and install ffmpeg')
return False, ''

Expand Down
1 change: 1 addition & 0 deletions app/transcribe/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ deepgram-sdk==3.2.5
--extra-index-url https://download.pytorch.org/whl/cu121
torch
bandit==1.7.8
static-ffmpeg
1 change: 1 addition & 0 deletions tsutils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def download_using_bits(file_url: str, file_path: str):
print(f'Failed to download the file: {file_url}')
except FileNotFoundError:
print('Please install Powershell or ensure it is in path.')
# Remove comment about ffmpeg
print('Powershell is required to download models and install ffmpeg')


Expand Down