Skip to content
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ graph TD

### Installation(有 GPU 版本)

> 是否有 GPU 以 `nvidia-smi` 显示驱动以及 `CUDA` 检查通过为准。如果未配置显卡驱动或未安装 `CUDA`,即使有 GPU 也无法使用。
> 是否有 GPU 以 `nvidia-smi` 显示 nvidia GPU 驱动以及 `nvcc -V` 显示 `CUDA` 版本号为准。如果未配置显卡驱动或未安装 `CUDA`,即使有 GPU 也无法使用,而会使用 CPU 推理(不推荐,可根据自身硬件条件判断是否尝试 CPU 推理)

> [!TIP]
> 如果你是 windows 用户,请不要使用命令提示符(Command Prompt)或 Windows PowerShell,请使用 [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4) 或 WSL 或 **Git Bash**(推荐)。
Expand Down Expand Up @@ -178,7 +178,7 @@ logs # 日志文件夹
### Installation(无 GPU 版本)
无 GPU 版本过程基本同上,可以跳过步骤 3,需要注意在执行步骤 5 **之前**完成以下设置将确保完全用 CPU 渲染视频弹幕。

1. 请将 `src/allconfig.py` 文件中的 `GPU_EXIST` 参数设置为 `False`
1. 请将 `src/allconfig.py` 文件中的 `GPU_EXIST` 参数设置为 `False`。(若不置为 `False` 且则会使用 CPU 推理,不推荐,可自行根据硬件条件进行尝试。)
2. 将 `MODEL_TYPE` 调整为 `merge` 或者 `append`。

> [!TIP]
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## Installation(有 GPU 版本)

> 是否有 GPU 以 `nvidia-smi` 显示驱动以及 `CUDA` 检查通过为准。如果未配置显卡驱动或未安装 `CUDA`,即使有 GPU 也无法使用。
> 是否有 GPU 以 `nvidia-smi` 显示 nvidia GPU 驱动以及 `nvcc -V` 显示 `CUDA` 版本号为准。如果未配置显卡驱动或未安装 `CUDA`,即使有 GPU 也无法使用,而会使用 CPU 推理(不推荐,可根据自身硬件条件判断是否尝试 CPU 推理)

> [!TIP]
> 如果你是 windows 用户,请不要使用命令提示符(Command Prompt)或 Windows PowerShell,请使用 [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4) 或 WSL 或 **Git Bash**(推荐)。
Expand Down Expand Up @@ -107,5 +107,5 @@ logs # 日志文件夹
## Installation(无 GPU 版本)
无 GPU 版本过程基本同上,可以跳过步骤 3,需要注意在执行步骤 5 **之前**完成以下设置将确保完全用 CPU 渲染视频弹幕。

1. 请将 `src/allconfig.py` 文件中的 `GPU_EXIST` 参数设置为 `False`
1. 请将 `src/allconfig.py` 文件中的 `GPU_EXIST` 参数设置为 `False`。(若不置为 `False` 且则会使用 CPU 推理,不推荐,可自行根据硬件条件进行尝试。)
2. 将 `MODEL_TYPE` 调整为 `merge` 或者 `append`。
4 changes: 0 additions & 4 deletions src/subtitle/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def init_settings_config():

init_settings_config()

ffmpeg_bin = os.path.join('linux_x64', 'ffmpeg')
FFMPEG_PATH = os.path.join(BASE_DIR, '', ffmpeg_bin)
os.chmod(FFMPEG_PATH, stat.S_IRWXU+stat.S_IRWXG+stat.S_IRWXO)

SILENCE_THRESH = -70 # silence below -70dBFS is considered silence
MIN_SILENCE_LEN = 700 # if silence is longer than 700ms, split
LENGTH_LIMIT = 60 * 1000 # split into segments no longer than 1 minute
Expand Down
9 changes: 3 additions & 6 deletions src/subtitle/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __call__(self, region):
start = max(0, start - self.include_before)
end += self.include_after
temp = tempfile.NamedTemporaryFile(suffix='.flac', delete=False)
command = [config.FFMPEG_PATH, "-ss", str(start), "-t", str(end - start),
command = ["ffmpeg", "-ss", str(start), "-t", str(end - start),
"-y", "-i", self.source_path,
"-loglevel", "error", temp.name]
use_shell = True if os.name == "nt" else False
Expand Down Expand Up @@ -170,10 +170,7 @@ def extract_audio(self, rate=16000):
if not os.path.isfile(self.filename):
print("The given file does not exist: {}".format(self.filename))
raise Exception("Invalid filepath: {}".format(self.filename))
if not self.which(config.FFMPEG_PATH):
print("ffmpeg: Executable not found on machine.")
raise Exception("Dependency not found: ffmpeg")
command = [config.FFMPEG_PATH, "-y", "-i", self.filename,
command = ["ffmpeg", "-y", "-i", self.filename,
"-ac", '1', "-ar", str(rate),
"-loglevel", "error", temp.name]
use_shell = True if os.name == "nt" else False
Expand Down Expand Up @@ -252,7 +249,7 @@ def run(self, output=None):
"""
audio_filename, audio_rate = self.extract_audio()
regions = self.find_speech_regions(audio_filename)
pool = multiprocessing.Pool(10)
pool = multiprocessing.Pool(12)
converter = FLACConverter(source_path=audio_filename)
recognizer = AudioRecogniser(language=self.language)
transcripts = []
Expand Down
Binary file removed src/subtitle/linux_x64/ffmpeg
Binary file not shown.