add requirements and ffmpeg setup
This commit is contained in:
parent
1d6e0ce290
commit
19abb65860
4
main.py
4
main.py
@ -11,6 +11,10 @@ import time
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
from src.utils.prereq import check_ffmpeg, install_ffmpeg
|
||||||
|
|
||||||
|
check_ffmpeg()
|
||||||
|
|
||||||
from src.mediautils.audio import extract_audio_from_video
|
from src.mediautils.audio import extract_audio_from_video
|
||||||
from src.mediautils.video import render_moments, filter_moments
|
from src.mediautils.video import render_moments, filter_moments
|
||||||
from src.editors.amplitude.editor import AmplitudeEditor
|
from src.editors.amplitude.editor import AmplitudeEditor
|
||||||
|
8
requirements.txt
Normal file
8
requirements.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
structlog==22.3.0
|
||||||
|
rich==13.3.1
|
||||||
|
numpy==1.24.2
|
||||||
|
moviepy==1.0.3
|
||||||
|
scipy==1.10.0
|
||||||
|
openai-whisper==20230124
|
||||||
|
flair==0.11.3
|
||||||
|
click==8.1.3
|
0
src/utils/__init__.py
Normal file
0
src/utils/__init__.py
Normal file
35
src/utils/prereq.py
Normal file
35
src/utils/prereq.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
import structlog
|
||||||
|
import click
|
||||||
|
import sys
|
||||||
|
|
||||||
|
log = structlog.get_logger()
|
||||||
|
|
||||||
|
|
||||||
|
def install_ffmpeg():
|
||||||
|
if not click.confirm('Do you want to install ffmpeg? It is required for ALE.', default=False):
|
||||||
|
log.warn("ffmpeg not installed. Please install it manually or restart ALE. Exiting...")
|
||||||
|
sys.exit(0)
|
||||||
|
system = platform.system().lower()
|
||||||
|
if system == "linux":
|
||||||
|
package_manager = "apt-get" if os.path.exists("/etc/apt/sources.list") else "yum"
|
||||||
|
command = f"sudo {package_manager} install -y ffmpeg"
|
||||||
|
elif system == "darwin":
|
||||||
|
command = "brew install ffmpeg"
|
||||||
|
else:
|
||||||
|
raise Exception(f"Unsupported operating system: {system}")
|
||||||
|
try:
|
||||||
|
subprocess.check_call(command.split())
|
||||||
|
print("ffmpeg has been installed successfully!")
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f"An error occurred while installing ffmpeg: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
def check_ffmpeg():
|
||||||
|
try:
|
||||||
|
subprocess.check_call(["ffmpeg", "-version"], stdout=subprocess.DEVNULL)
|
||||||
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||||
|
log.info("ffmpeg is not installed.")
|
||||||
|
install_ffmpeg()
|
Loading…
Reference in New Issue
Block a user