diff --git a/README.md b/README.md
index 5ec45887..83d533c9 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@
近后台计算,模型优化和翻译消耗费用不足 ¥0.01(以OpenAI官方价格为计算)
-具体字幕和视频合成的效果的测试结果图片,请参考 [TED视频测试](./docs/test.md)
+具体字幕和视频合成的效果的测试结果图片,请参考 [TED视频测试](./legacy-docs/test.md)
## 快速开始
@@ -51,26 +51,22 @@
3. LLM API 配置,(用于字幕断句、校正),可使用[本项目的中转站](https://api.videocaptioner.cn)
-4. 翻译配置,选择是否启用翻译,翻译服务(默认使用微软翻译,质量一般,推荐使用大模型翻译)
+4. 翻译配置,选择是否启用翻译,翻译服务(默认使用微软翻译,质量一般,推荐配置自己的 API KEY 使用大模型翻译)
5. 语音识别配置(默认使用B接口网络调用语音识别服务,中英以外的语言请使用本地转录)
-6. 拖拽视频文件到软件窗口,即可全自动处理
-
-提示:每一个步骤均支持单独处理,均支持文件拖拽。软件具体模型选择和参数配置说明,请查看下文。
-
-### macOS / Linux 用户
+### macOS 用户
#### 一键安装运行(推荐)
```bash
-# 方式一:直接运行(自动安装 uv、克隆项目、安装依赖)
-curl -fsSL https://raw.githubusercontent.com/WEIFENG2333/VideoCaptioner/main/run.sh | bash
+# 方式一:直接运行(自动安装 uv、克隆项目、安装相关依赖)
+curl -fsSL https://raw.githubusercontent.com/WEIFENG2333/VideoCaptioner/main/scripts/run.sh | bash
# 方式二:先克隆再运行
git clone https://github.com/WEIFENG2333/VideoCaptioner.git
cd VideoCaptioner
-./run.sh
+./scripts/run.sh
```
脚本会自动:
@@ -92,7 +88,7 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
#### 2. 安装系统依赖(macOS)
```bash
-brew install ffmpeg aria2
+brew install ffmpeg
```
#### 3. 克隆并运行
@@ -130,7 +126,7 @@ LLM 大模型是用来字幕段句、字幕优化、以及字幕翻译(如果
| 配置项 | 说明 |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| SiliconCloud | [SiliconCloud 官网](https://cloud.siliconflow.cn/i/onCHcaDx)配置方法请参考[配置文档](./docs/llm_config.md)
该并发较低,建议把线程设置为5以下。 |
+| SiliconCloud | [SiliconCloud 官网](https://cloud.siliconflow.cn/i/onCHcaDx)配置方法请参考[配置文档](https://weifeng2333.github.io/VideoCaptioner/config/llm)
该并发较低,建议把线程设置为5以下。 |
| DeepSeek | [DeepSeek 官网](https://platform.deepseek.com),建议使用 `deepseek-v3` 模型,
官方网站最近服务好像并不太稳定。 |
| OpenAI兼容接口 | 如果有其他服务商的API,可直接在软件中填写。base_url 和api_key [VideoCaptioner API](https://api.videocaptioner.cn) |
@@ -152,15 +148,15 @@ API-key: `个人中心-API 令牌页面自行获取。`
💡 模型选择建议 (本人在各质量层级中精选出的高性价比模型):
-- 高质量之选: `gemini-2.5-pro`、`claude-sonnet-4-5-20250929` (耗费比例:3)
+- 高质量之选: `gemini-3-pro`、`claude-sonnet-4-5-20250929` (耗费比例:3)
- 较高质量之选: `gpt-5-2025-08-07`、 `claude-haiku-4-5-20251001` (耗费比例:1.2)
-- 中质量之选: `gpt-5-mini`、`gemini-2.5-flash` (耗费比例:0.3)
+- 中质量之选: `gpt-5-mini`、`gemini-3-flash` (耗费比例:0.3)
本站支持超高并发,软件中线程数直接拉满即可~ 处理速度非常快~
-更详细的API配置教程:[中转站配置配置](./docs/llm_config.md#中转站配置)
+更详细的API配置教程:[中转站配置](https://weifeng2333.github.io/VideoCaptioner/config/llm)
---
@@ -181,7 +177,7 @@ API-key: `个人中心-API 令牌页面自行获取。`
| B接口 | 仅支持中文、英文 | 在线 | 免费、速度较快 |
| J接口 | 仅支持中文、英文 | 在线 | 免费、速度较快 |
| WhisperCpp | 中文、日语、韩语、英文等 99 种语言,外语效果较好 | 本地 | (实际使用不稳定)需要下载转录模型
中文建议medium以上模型
英文等使用较小模型即可达到不错效果。 |
-| fasterWhisper 👍 | 中文、英文等多99种语言,外语效果优秀,时间轴更准确 | 本地 | (🌟极力推荐🌟)需要下载程序和转录模型
支持CUDA,速度更快,转录准确。
超级准确的时间戳字幕。
建议优先使用 |
+| fasterWhisper 👍 | 中文、英文等多99种语言,外语效果优秀,时间轴更准确 | 本地 | (🌟推荐🌟)需要下载程序和转录模型
支持CUDA,速度更快,转录准确。
超级准确的时间戳字幕。
仅支持 window |
### 4. 本地 Whisper 语音识别模型
@@ -197,7 +193,6 @@ Whisper 版本有 WhisperCpp 和 fasterWhisper(推荐) 两种,后者效果
推荐模型: `Large-v2` 稳定且质量较好。
-注:以上模型国内网络可直接在软件内下载。
### 5. 文稿匹配
@@ -222,7 +217,7 @@ Whisper 版本有 WhisperCpp 和 fasterWhisper(推荐) 两种,后者效果
2. 只能下载较低分辨率的视频;
3. 网络条件较差时需要验证;
-- 请参考 [Cookie 配置说明](./docs/get_cookies.md) 获取Cookie信息,并将cookies.txt文件放置到软件安装目录的 `AppData` 目录下,即可正常下载高质量视频。
+- 请参考 [Cookie 配置说明](https://weifeng2333.github.io/VideoCaptioner/guide/cookies-config) 获取Cookie信息,并将cookies.txt文件放置到软件安装目录的 `AppData` 目录下,即可正常下载高质量视频。
## 软件流程介绍
@@ -291,16 +286,27 @@ Whisper 版本有 WhisperCpp 和 fasterWhisper(推荐) 两种,后者效果
```
VideoCaptioner/
-├── runtime/ # 运行环境目录
-├── resources/ # 软件资源文件目录(二进制程序、图标等,以及下载的faster-whisper程序)
-├── work-dir/ # 工作目录,处理完成的视频和字幕文件保存在这里
+├── app/ # 应用源代码目录
+│ ├── common/ # 公共模块(配置、信号总线)
+│ ├── components/ # UI 组件
+│ ├── core/ # 核心业务逻辑(ASR、翻译、优化等)
+│ ├── thread/ # 异步线程
+│ └── view/ # 界面视图
+├── resource/ # 资源文件目录
+│ ├── assets/ # 图标、Logo 等
+│ ├── bin/ # 二进制程序(FFmpeg、Whisper 等)
+│ ├── fonts/ # 字体文件
+│ ├── subtitle_style/ # 字幕样式模板
+│ └── translations/ # 多语言翻译文件
+├── work-dir/ # 工作目录(处理完成的视频和字幕)
├── AppData/ # 应用数据目录
- ├── cache/ # 缓存目录,缓存转录、大模型请求的数据。
- ├── models/ # 存放 Whisper 模型文件
- ├── logs/ # 日志目录,记录软件运行状态
- ├── settings.json # 存储用户设置
- └── cookies.txt # 视频平台的 cookie 信息(下载高清视频时需要)
-└── VideoCaptioner.exe # 主程序执行文件
+│ ├── cache/ # 缓存目录(转录、LLM 请求)
+│ ├── models/ # Whisper 模型文件
+│ ├── logs/ # 日志文件
+│ └── settings.json # 用户设置
+├── scripts/ # 安装和运行脚本
+├── main.py # 程序入口
+└── pyproject.toml # 项目配置和依赖
```
## 📝 说明
@@ -328,8 +334,8 @@ VideoCaptioner/
捐助支持
diff --git a/app/common/config.py b/app/common/config.py
index 6fb5fc48..566b8110 100644
--- a/app/common/config.py
+++ b/app/common/config.py
@@ -233,7 +233,7 @@ class Config(QConfig):
EnumSerializer(TargetLanguage),
)
max_word_count_cjk = ConfigItem(
- "Subtitle", "MaxWordCountCJK", 25, RangeValidator(8, 100)
+ "Subtitle", "MaxWordCountCJK", 28, RangeValidator(8, 100)
)
max_word_count_english = ConfigItem(
"Subtitle", "MaxWordCountEnglish", 20, RangeValidator(8, 100)
@@ -250,6 +250,7 @@ class Config(QConfig):
OptionsValidator(VideoQualityEnum),
EnumSerializer(VideoQualityEnum),
)
+ use_subtitle_style = ConfigItem("Video", "UseSubtitleStyle", False, BoolValidator())
# ------------------- 字幕样式配置 -------------------
subtitle_style_name = ConfigItem("SubtitleStyle", "StyleName", "default")
diff --git a/app/common/signal_bus.py b/app/common/signal_bus.py
index a0cdea72..a3859a7b 100644
--- a/app/common/signal_bus.py
+++ b/app/common/signal_bus.py
@@ -18,6 +18,10 @@ class SignalBus(QObject):
need_video_changed = pyqtSignal(bool)
# 视频质量信号
video_quality_changed = pyqtSignal(str)
+ # 使用样式信号
+ use_subtitle_style_changed = pyqtSignal(bool)
+ # 渲染模式变更信号
+ subtitle_render_mode_changed = pyqtSignal(str)
# 新增视频控制相关信号
video_play = pyqtSignal() # 播放信号
diff --git a/app/core/constant.py b/app/core/constant.py
index 502ac018..31c367a3 100644
--- a/app/core/constant.py
+++ b/app/core/constant.py
@@ -5,6 +5,7 @@
"""
# InfoBar 显示时长配置(单位:毫秒)
+INFOBAR_DURATION_FOREVER = 24 * 60 * 60 * 1000 # 永久提示:1天
INFOBAR_DURATION_ERROR = 10000 # 错误提示:10秒
INFOBAR_DURATION_WARNING = 5000 # 警告提示:5秒
INFOBAR_DURATION_INFO = 3000 # 信息提示:3秒
diff --git a/app/core/entities.py b/app/core/entities.py
index 0493b1ca..5e0c0235 100644
--- a/app/core/entities.py
+++ b/app/core/entities.py
@@ -98,7 +98,7 @@ class TranscribeOutputFormatEnum(Enum):
class LLMServiceEnum(Enum):
"""LLM服务"""
- OPENAI = "OpenAI"
+ OPENAI = "OpenAI 兼容"
SILICON_CLOUD = "SiliconCloud"
DEEPSEEK = "DeepSeek"
OLLAMA = "Ollama"
diff --git a/app/core/llm/check_llm.py b/app/core/llm/check_llm.py
index 572571f6..7ba6f150 100644
--- a/app/core/llm/check_llm.py
+++ b/app/core/llm/check_llm.py
@@ -93,11 +93,11 @@ def get_available_models(base_url: str, api_key: str) -> list[str]:
# 根据不同模型设置权重进行排序
def get_model_weight(model_name: str) -> int:
model_name = model_name.lower()
- if model_name.startswith(("gpt-5", "claude-4", "gemini-2")):
+ if model_name.startswith(("gpt-5", "claude-4", "gemini-2", "gemini-3")):
return 10
elif model_name.startswith(("gpt-4")):
return 5
- elif model_name.startswith(("deepseek", "glm", "qwen")):
+ elif model_name.startswith(("deepseek", "glm", "qwen", "doubao")):
return 3
return 0
diff --git a/app/core/split/split_by_llm.py b/app/core/split/split_by_llm.py
index ce20c9ca..b88eed60 100644
--- a/app/core/split/split_by_llm.py
+++ b/app/core/split/split_by_llm.py
@@ -10,7 +10,7 @@
logger = setup_logger("split_by_llm")
MAX_WORD_COUNT = 20 # 英文单词或中文字符的最大数量
-MAX_STEPS = 3 # Agent loop最大尝试次数
+MAX_STEPS = 2 # Agent loop最大尝试次数
def split_by_llm(
@@ -95,7 +95,7 @@ def _split_with_agent_loop(
# 添加反馈到对话
logger.warning(
- f"模型输出错误,断句验证失败,频繁出现建议更换更智能的模型。开始反馈循环 (第{step + 1}次尝试):\n {error_message}\n\n"
+ f"模型输出错误,断句验证失败,频繁出现建议更换更智能的模型或者调整最大字数限制。开始反馈循环 (第{step + 1}次尝试):\n {error_message}\n\n"
)
messages.append({"role": "assistant", "content": result_text})
messages.append(
diff --git a/app/core/subtitle/rounded_renderer.py b/app/core/subtitle/rounded_renderer.py
index 75fbb0b5..b3f67f19 100644
--- a/app/core/subtitle/rounded_renderer.py
+++ b/app/core/subtitle/rounded_renderer.py
@@ -306,7 +306,6 @@ def render_rounded_video(
for seg in asr_data.segments
)
if not has_translation:
- logger.warning("选择了'仅译文'但没有翻译文本,自动切换到'仅原文'")
layout = SubtitleLayoutEnum.ONLY_ORIGINAL
elif (
layout == SubtitleLayoutEnum.TRANSLATE_ON_TOP
@@ -317,7 +316,6 @@ def render_rounded_video(
for seg in asr_data.segments
)
if not has_translation:
- logger.warning("没有翻译文本,自动切换到'仅原文'")
layout = SubtitleLayoutEnum.ONLY_ORIGINAL
# 获取视频信息
diff --git a/app/core/task_factory.py b/app/core/task_factory.py
index 81a6444f..c846a502 100644
--- a/app/core/task_factory.py
+++ b/app/core/task_factory.py
@@ -206,14 +206,16 @@ def create_synthesis_task(
Path(video_path).parent / f"【卡卡】{Path(video_path).stem}.mp4"
)
+ # 只有启用样式时才传入样式配置
+ use_style = cfg.use_subtitle_style.value
config = SynthesisConfig(
need_video=cfg.need_video.value,
soft_subtitle=cfg.soft_subtitle.value,
render_mode=cfg.subtitle_render_mode.value,
video_quality=cfg.video_quality.value,
subtitle_layout=cfg.subtitle_layout.value,
- ass_style=TaskFactory.get_ass_style(cfg.subtitle_style_name.value),
- rounded_style=TaskFactory.get_rounded_style(),
+ ass_style=TaskFactory.get_ass_style(cfg.subtitle_style_name.value) if use_style else "",
+ rounded_style=TaskFactory.get_rounded_style() if use_style else None,
)
return SynthesisTask(
diff --git a/app/thread/file_download_thread.py b/app/thread/file_download_thread.py
index 09aa1198..aa1afce1 100644
--- a/app/thread/file_download_thread.py
+++ b/app/thread/file_download_thread.py
@@ -1,7 +1,9 @@
-import os
import shutil
import subprocess
+from abc import ABC, abstractmethod
+from pathlib import Path
+import requests
from PyQt5.QtCore import QThread, pyqtSignal
from app.config import CACHE_PATH
@@ -11,102 +13,218 @@
logger = setup_logger("download_thread")
+class BaseDownloader(ABC):
+ """下载器基类"""
+
+ def __init__(self, url: str, save_path: Path, progress_callback):
+ self.url = url
+ self.save_path = save_path
+ self.progress_callback = progress_callback
+ self._cancelled = False
+
+ @abstractmethod
+ def download(self) -> bool:
+ """执行下载,返回是否成功"""
+ pass
+
+ def cancel(self):
+ """取消下载"""
+ self._cancelled = True
+
+
+class Aria2Downloader(BaseDownloader):
+ """aria2c 多线程下载器"""
+
+ def __init__(self, url: str, save_path: Path, progress_callback):
+ super().__init__(url, save_path, progress_callback)
+ self.process = None
+
+ @staticmethod
+ def is_available() -> bool:
+ """检查 aria2c 是否可用"""
+ return shutil.which("aria2c") is not None
+
+ def download(self) -> bool:
+ temp_dir = CACHE_PATH / "download_cache"
+ temp_dir.mkdir(parents=True, exist_ok=True)
+ temp_file = temp_dir / self.save_path.name
+
+ cmd = [
+ "aria2c",
+ "--no-conf",
+ "--show-console-readout=false",
+ "--summary-interval=1",
+ "--max-connection-per-server=2",
+ "--split=2",
+ "--connect-timeout=10",
+ "--timeout=10",
+ "--max-tries=2",
+ "--retry-wait=1",
+ "--continue=true",
+ "--auto-file-renaming=false",
+ "--allow-overwrite=true",
+ "--check-certificate=false",
+ f"--dir={temp_dir}",
+ f"--out={temp_file.name}",
+ self.url,
+ ]
+
+ subprocess_args = {
+ "stdout": subprocess.PIPE,
+ "stderr": subprocess.PIPE,
+ "universal_newlines": True,
+ "encoding": "utf-8",
+ **get_subprocess_kwargs(),
+ }
+
+ logger.info(f"使用 aria2c 下载: {self.url}")
+ self.process = subprocess.Popen(cmd, **subprocess_args)
+
+ while True:
+ if self._cancelled:
+ self.process.terminate()
+ return False
+
+ if self.process.poll() is not None:
+ break
+
+ line = self.process.stdout.readline()
+ self._parse_progress(line)
+
+ if self.process.returncode == 0:
+ self.save_path.parent.mkdir(parents=True, exist_ok=True)
+ shutil.move(str(temp_file), self.save_path)
+ return True
+ else:
+ error = self.process.stderr.read()
+ logger.error(f"aria2c 下载失败: {error}")
+ return False
+
+ def _parse_progress(self, line: str):
+ """解析 aria2c 输出格式: [#40ca1b 2.4MiB/74MiB(3%) CN:2 DL:3.9MiB ETA:18s]"""
+ if "[#" not in line or "]" not in line:
+ return
+
+ try:
+ progress_part = line.split("(")[1].split(")")[0]
+ percent = float(progress_part.strip("%"))
+
+ speed = "0"
+ eta = ""
+ if "DL:" in line:
+ speed = line.split("DL:")[1].split()[0]
+ if "ETA:" in line:
+ eta = line.split("ETA:")[1].split("]")[0]
+
+ status = f"速度: {speed}/s, 剩余: {eta}"
+ self.progress_callback(percent, status)
+ except Exception:
+ pass
+
+ def cancel(self):
+ super().cancel()
+ if self.process:
+ self.process.terminate()
+ self.process.wait()
+
+
+class RequestsDownloader(BaseDownloader):
+ """Python requests 下载器(回退方案)"""
+
+ CHUNK_SIZE = 8192
+
+ def download(self) -> bool:
+ logger.info(f"使用 requests 下载: {self.url}")
+ self.progress_callback(0, "正在连接...")
+
+ try:
+ response = requests.get(self.url, stream=True, timeout=30)
+ response.raise_for_status()
+
+ total_size = int(response.headers.get("content-length", 0))
+ downloaded = 0
+
+ self.save_path.parent.mkdir(parents=True, exist_ok=True)
+ temp_file = self.save_path.with_suffix(".tmp")
+
+ with open(temp_file, "wb") as f:
+ for chunk in response.iter_content(chunk_size=self.CHUNK_SIZE):
+ if self._cancelled:
+ temp_file.unlink(missing_ok=True)
+ return False
+
+ f.write(chunk)
+ downloaded += len(chunk)
+
+ if total_size > 0:
+ percent = (downloaded / total_size) * 100
+ speed = self._format_size(downloaded)
+ status = f"已下载: {speed} / {self._format_size(total_size)}"
+ self.progress_callback(percent, status)
+
+ # 下载完成后重命名
+ shutil.move(str(temp_file), self.save_path)
+ return True
+
+ except requests.RequestException as e:
+ logger.error(f"requests 下载失败: {e}")
+ return False
+
+ @staticmethod
+ def _format_size(bytes_size: int) -> str:
+ """格式化文件大小"""
+ size = float(bytes_size)
+ for unit in ["B", "KB", "MB", "GB"]:
+ if size < 1024:
+ return f"{size:.1f}{unit}"
+ size /= 1024
+ return f"{size:.1f}TB"
+
+
class FileDownloadThread(QThread):
+ """文件下载线程"""
+
progress = pyqtSignal(float, str)
finished = pyqtSignal()
error = pyqtSignal(str)
- def __init__(self, url, save_path):
+ def __init__(self, url: str, save_path: str):
super().__init__()
self.url = url
- self.save_path = save_path
- self.process = None
+ self.save_path = Path(save_path)
+ self.downloader: BaseDownloader | None = None
def run(self):
try:
- # 创建缓存下载目录
- temp_dir = CACHE_PATH / "aria2c_download_cache"
- temp_dir.mkdir(parents=True, exist_ok=True)
- temp_file = temp_dir / os.path.basename(self.save_path)
-
- # 检查是否存在未完成的下载文件
- if temp_file.exists():
- logger.info(f"发现未完成的下载文件: {temp_file}")
self.progress.emit(0, self.tr("正在连接..."))
- cmd = [
- "aria2c",
- "--no-conf",
- "--show-console-readout=false",
- "--summary-interval=1",
- "--max-connection-per-server=2",
- "--split=2",
- "--connect-timeout=10",
- "--timeout=10",
- "--max-tries=2",
- "--retry-wait=1",
- "--continue=true",
- "--auto-file-renaming=false",
- "--allow-overwrite=true",
- "--check-certificate=false",
- f"--dir={temp_dir}",
- f"--out={temp_file.name}",
- self.url,
- ]
-
- # 根据操作系统设置不同的 subprocess 参数
- subprocess_args = {
- "stdout": subprocess.PIPE,
- "stderr": subprocess.PIPE,
- "universal_newlines": True,
- "encoding": "utf-8",
- }
-
- # 获取跨平台的subprocess参数
- subprocess_args.update(get_subprocess_kwargs())
-
- logger.info("运行下载命令: %s", " ".join(cmd))
-
- self.process = subprocess.Popen(cmd, **subprocess_args)
-
- while True:
- if self.process.poll() is not None:
- break
-
- line = self.process.stdout.readline()
-
- if "[#" in line and "]" in line:
- try:
- # 解析类似 "[#40ca1b 2.4MiB/74MiB(3%) CN:2 DL:3.9MiB ETA:18s]" 的格式
- progress_part = line.split("(")[1].split(")")[0]
- percent = float(progress_part.strip("%"))
-
- # 提取下载速度和剩余时间
- speed = "0"
- eta = ""
- if "DL:" in line:
- speed = line.split("DL:")[1].split()[0]
- if "ETA:" in line:
- eta = line.split("ETA:")[1].split("]")[0]
- status_msg = f"{self.tr('速度')}: {speed}/s, {self.tr('剩余时间')}: {eta}"
- self.progress.emit(percent, status_msg)
- except Exception:
- pass
-
- if self.process.returncode == 0:
- # 下载完成后移动文件到目标位置
- os.makedirs(os.path.dirname(self.save_path), exist_ok=True)
- shutil.move(str(temp_file), self.save_path)
+
+ # 选择下载器:优先 aria2c,否则回退到 requests
+ if Aria2Downloader.is_available():
+ self.downloader = Aria2Downloader(
+ self.url, self.save_path, self._on_progress
+ )
+ else:
+ logger.info("aria2c 不可用,使用 requests 下载")
+ self.downloader = RequestsDownloader(
+ self.url, self.save_path, self._on_progress
+ )
+
+ success = self.downloader.download()
+
+ if success:
self.finished.emit()
else:
- error = self.process.stderr.read()
- logger.error("下载失败: %s", error)
- self.error.emit(f"{self.tr('下载失败')}: {error}")
+ self.error.emit(self.tr("下载失败"))
except Exception as e:
- logger.error("下载异常: %s", str(e))
+ logger.exception("下载异常")
self.error.emit(str(e))
+ def _on_progress(self, percent: float, status: str):
+ """进度回调"""
+ self.progress.emit(percent, status)
+
def stop(self):
- if self.process:
- self.process.terminate()
- self.process.wait()
+ """停止下载"""
+ if self.downloader:
+ self.downloader.cancel()
diff --git a/app/view/batch_process_interface.py b/app/view/batch_process_interface.py
index 0934a179..cd5f3617 100644
--- a/app/view/batch_process_interface.py
+++ b/app/view/batch_process_interface.py
@@ -27,6 +27,7 @@
)
from app.core.constant import (
+ INFOBAR_DURATION_INFO,
INFOBAR_DURATION_SUCCESS,
INFOBAR_DURATION_WARNING,
)
@@ -69,6 +70,14 @@ def init_ui(self):
self.task_type_combo.addItems([str(task_type) for task_type in BatchTaskType])
self.task_type_combo.setCurrentText(str(BatchTaskType.FULL_PROCESS))
+ # 任务类型说明
+ self.task_type_descriptions = {
+ str(BatchTaskType.TRANSCRIBE): self.tr("仅进行语音识别,生成字幕文件"),
+ str(BatchTaskType.SUBTITLE): self.tr("对已有字幕进行分割、优化或翻译"),
+ str(BatchTaskType.TRANS_SUB): self.tr("先转录再处理字幕,不合成视频"),
+ str(BatchTaskType.FULL_PROCESS): self.tr("转录 → 字幕处理 → 合成视频"),
+ }
+
# 控制按钮
self.add_file_btn = PushButton(self.tr("添加文件"), icon=FIF.ADD)
self.start_all_btn = PushButton(self.tr("开始处理"), icon=FIF.PLAY)
@@ -422,7 +431,17 @@ def clear_tasks(self):
self.batch_thread.stop_all()
self.task_table.setRowCount(0)
- def on_task_type_changed(self, task_type):
+ def on_task_type_changed(self, task_type: str):
+ # 显示任务类型说明
+ description = self.task_type_descriptions.get(task_type, "")
+ if description:
+ InfoBar.info(
+ title=task_type,
+ content=description,
+ duration=INFOBAR_DURATION_INFO,
+ position=InfoBarPosition.BOTTOM,
+ parent=self,
+ )
# 清空当前任务列表
self.clear_tasks()
diff --git a/app/view/main_window.py b/app/view/main_window.py
index 77c7fc30..880d56e3 100644
--- a/app/view/main_window.py
+++ b/app/view/main_window.py
@@ -1,5 +1,6 @@
import atexit
import os
+import shutil
import psutil
from PyQt5.QtCore import QSize, QThread, QUrl
@@ -18,6 +19,7 @@
from app.common.config import cfg
from app.components.DonateDialog import DonateDialog
from app.config import ASSETS_PATH, GITHUB_REPO_URL
+from app.core.constant import INFOBAR_DURATION_FOREVER
from app.thread.version_checker_thread import VersionChecker
from app.view.batch_process_interface import BatchProcessInterface
from app.view.home_interface import HomeInterface
@@ -52,6 +54,9 @@ def __init__(self):
self.initNavigation()
self.splashScreen.finish()
+ # 检查系统依赖
+ self._check_ffmpeg()
+
# 注册退出处理, 清理进程
atexit.register(self.stop)
@@ -189,3 +194,14 @@ def stop(self):
process = psutil.Process(os.getpid())
for child in process.children(recursive=True):
child.kill()
+
+ def _check_ffmpeg(self):
+ """检查 FFmpeg 是否已安装"""
+ if shutil.which("ffmpeg") is None:
+ InfoBar.warning(
+ self.tr("FFmpeg 未安装"),
+ self.tr("软件处理音视频文件时需要 FFmpeg,请先安装"),
+ duration=INFOBAR_DURATION_FOREVER,
+ position=InfoBarPosition.BOTTOM,
+ parent=self,
+ )
diff --git a/app/view/setting_interface.py b/app/view/setting_interface.py
index 0d6375de..0c3a2048 100644
--- a/app/view/setting_interface.py
+++ b/app/view/setting_interface.py
@@ -264,8 +264,8 @@ def __createLLMServiceCards(self):
self.llmServiceCard = ComboBoxSettingCard(
cfg.llm_service,
FIF.ROBOT,
- self.tr("LLM服务"),
- self.tr("选择大模型服务,用于字幕断句、字幕优化、字幕翻译"),
+ self.tr("LLM 提供商"),
+ self.tr("选择大模型提供商,用于字幕断句、优化、翻译"),
texts=[service.value for service in cfg.llm_service.validator.options], # type: ignore
parent=self.llmGroup,
)
diff --git a/app/view/subtitle_style_interface.py b/app/view/subtitle_style_interface.py
index 422f92cb..f6593a51 100644
--- a/app/view/subtitle_style_interface.py
+++ b/app/view/subtitle_style_interface.py
@@ -681,6 +681,9 @@ def connectSignals(self):
)
signalBus.subtitle_layout_changed.connect(self.on_subtitle_layout_changed)
+ # 连接渲染模式信号(从视频合成界面同步)
+ signalBus.subtitle_render_mode_changed.connect(self.on_render_mode_changed_external)
+
def on_open_style_folder_clicked(self):
"""打开样式文件夹"""
open_folder(str(SUBTITLE_STYLE_PATH))
@@ -690,11 +693,23 @@ def on_subtitle_layout_changed(self, layout: str):
cfg.subtitle_layout.value = layout_enum
self.layoutCard.setCurrentText(layout)
+ def on_render_mode_changed_external(self, mode_text: str):
+ """处理外部渲染模式变更(从视频合成界面同步)"""
+ # 避免信号循环:阻断信号后再更新
+ self.renderModeCard.comboBox.blockSignals(True)
+ self.renderModeCard.comboBox.setCurrentText(mode_text)
+ self.renderModeCard.comboBox.blockSignals(False)
+ # 手动触发 UI 更新
+ self._updateVisibleGroups()
+ self._refreshStyleList()
+ self.updatePreview()
+
def onRenderModeChanged(self):
- """渲染模式切换"""
+ """渲染模式切换(本界面触发)"""
mode_text = self.renderModeCard.comboBox.currentText()
mode = SubtitleRenderModeEnum(mode_text)
cfg.set(cfg.subtitle_render_mode, mode)
+ signalBus.subtitle_render_mode_changed.emit(mode_text)
self._updateVisibleGroups()
self._refreshStyleList()
self.updatePreview()
diff --git a/app/view/video_synthesis_interface.py b/app/view/video_synthesis_interface.py
index 847ecfaf..a7f2aa55 100644
--- a/app/view/video_synthesis_interface.py
+++ b/app/view/video_synthesis_interface.py
@@ -33,6 +33,7 @@
INFOBAR_DURATION_WARNING,
)
from app.core.entities import (
+ SubtitleRenderModeEnum,
SupportedSubtitleFormats,
SupportedVideoFormats,
SynthesisTask,
@@ -42,9 +43,6 @@
from app.core.utils.platform_utils import open_folder
from app.thread.video_synthesis_thread import VideoSynthesisThread
-current_dir = Path(__file__).parent.parent
-SUBTITLE_STYLE_DIR = current_dir / "resource" / "subtitle_style"
-
class VideoSynthesisInterface(QWidget):
finished = pyqtSignal()
@@ -147,6 +145,36 @@ def _setup_command_bar(self):
# 添加分隔符
self.command_bar.addSeparator()
+ # 添加使用样式开关
+ self.use_style_action = Action(
+ FIF.PALETTE,
+ self.tr("使用样式"),
+ triggered=self.on_use_style_action_triggered,
+ checkable=True,
+ )
+ self.use_style_action.setToolTip(self.tr("启用字幕样式渲染"))
+ self.command_bar.addAction(self.use_style_action)
+
+ self.command_bar.addSeparator()
+
+ # 添加渲染模式下拉按钮
+ self.render_mode_button = TransparentDropDownPushButton(
+ self.tr("渲染模式"), self, FIF.FONT_SIZE
+ )
+ self.render_mode_button.setFixedHeight(34)
+ self.render_mode_button.setMinimumWidth(140)
+ self.render_mode_menu = RoundMenu(parent=self)
+ for mode in SubtitleRenderModeEnum:
+ action = Action(text=mode.value)
+ action.triggered.connect(
+ lambda checked, m=mode.value: self.on_render_mode_changed(m)
+ )
+ self.render_mode_menu.addAction(action)
+ self.render_mode_button.setMenu(self.render_mode_menu)
+ self.command_bar.addWidget(self.render_mode_button)
+
+ self.command_bar.addSeparator()
+
# 添加视频质量选择下拉按钮
self.video_quality_button = TransparentDropDownPushButton(
self.tr("视频质量"), self, FIF.SPEED_HIGH
@@ -183,11 +211,6 @@ def _setup_command_bar(self):
folder_action.setToolTip(self.tr("打开输出文件夹"))
self.command_bar.addAction(folder_action)
- # 添加文件选择按钮
- file_action = Action(FIF.FOLDER_ADD, "", triggered=self.choose_video_file)
- file_action.setToolTip(self.tr("选择视频文件"))
- self.command_bar.addAction(file_action)
-
def setup_style(self):
self.subtitle_input.focusOutEvent = lambda e: super(
LineEdit, self.subtitle_input
@@ -245,6 +268,8 @@ def setup_signals(self):
signalBus.soft_subtitle_changed.connect(self.on_soft_subtitle_changed)
signalBus.need_video_changed.connect(self.on_need_video_changed)
signalBus.video_quality_changed.connect(self.on_video_quality_changed)
+ signalBus.use_subtitle_style_changed.connect(self.on_use_style_changed)
+ signalBus.subtitle_render_mode_changed.connect(self.on_render_mode_changed_external)
def set_value(self):
"""设置初始值"""
@@ -252,15 +277,25 @@ def set_value(self):
self.need_video_action.setChecked(cfg.need_video.value)
self.video_quality_button.setText(cfg.video_quality.value.value)
+ # 设置样式相关初始值
+ self.use_style_action.setChecked(cfg.use_subtitle_style.value)
+ self.render_mode_button.setText(cfg.subtitle_render_mode.value.value)
+ self._update_synthesis_controls_state()
+
def on_soft_subtitle_action_triggered(self, checked: bool):
"""处理软字幕按钮点击(更新配置+显示InfoBar)"""
cfg.set(cfg.soft_subtitle, checked)
# 显示说明信息
if checked:
+ # 开启软字幕时自动关闭使用样式
+ if self.use_style_action.isChecked():
+ self.use_style_action.setChecked(False)
+ cfg.set(cfg.use_subtitle_style, False)
+ self._update_style_controls_state()
InfoBar.info(
self.tr("开启软字幕"),
- self.tr("字幕作为独立轨道嵌入视频,播放器中可关闭或调整"),
+ self.tr("字幕作为独立轨道嵌入视频,不包含字幕样式"),
duration=3000,
position=InfoBarPosition.BOTTOM,
parent=self,
@@ -268,7 +303,7 @@ def on_soft_subtitle_action_triggered(self, checked: bool):
else:
InfoBar.info(
self.tr("开启硬烧录字幕"),
- self.tr("字幕直接烧录到视频画面中,使用字幕样式配置"),
+ self.tr("字幕直接烧录到视频画面中,包含字幕样式"),
duration=3000,
position=InfoBarPosition.BOTTOM,
parent=self,
@@ -281,6 +316,7 @@ def on_soft_subtitle_changed(self, checked: bool):
def on_need_video_action_triggered(self, checked: bool):
"""处理视频合成按钮点击(更新配置+显示InfoBar)"""
cfg.set(cfg.need_video, checked)
+ self._update_synthesis_controls_state()
# 显示说明信息
if checked:
@@ -303,6 +339,7 @@ def on_need_video_action_triggered(self, checked: bool):
def on_need_video_changed(self, checked: bool):
"""处理外部视频合成配置变更(仅更新UI状态)"""
self.need_video_action.setChecked(checked)
+ self._update_synthesis_controls_state()
def on_video_quality_action_changed(self, quality_text: str):
"""处理质量选择"""
@@ -323,6 +360,72 @@ def on_video_quality_changed(self, quality_text: str):
"""处理外部质量配置变更(仅更新UI状态)"""
self.video_quality_button.setText(quality_text)
+ def on_use_style_action_triggered(self, checked: bool):
+ """处理使用样式开关点击"""
+ cfg.set(cfg.use_subtitle_style, checked)
+ self._update_style_controls_state()
+
+ if checked:
+ # 启用样式时自动关闭软字幕
+ if self.soft_subtitle_action.isChecked():
+ self.soft_subtitle_action.setChecked(False)
+ cfg.set(cfg.soft_subtitle, False)
+ InfoBar.info(
+ self.tr("启用字幕样式"),
+ self.tr("已自动切换为硬字幕渲染"),
+ duration=3000,
+ position=InfoBarPosition.BOTTOM,
+ parent=self,
+ )
+ else:
+ InfoBar.info(
+ self.tr("关闭字幕样式"),
+ self.tr("将使用默认字幕渲染"),
+ duration=3000,
+ position=InfoBarPosition.BOTTOM,
+ parent=self,
+ )
+
+ def on_use_style_changed(self, checked: bool):
+ """处理外部使用样式配置变更(仅更新 UI)"""
+ self.use_style_action.setChecked(checked)
+ self._update_style_controls_state()
+
+ def on_render_mode_changed(self, mode_text: str):
+ """处理渲染模式选择(本界面触发)"""
+ mode_enum = None
+ for e in SubtitleRenderModeEnum:
+ if e.value == mode_text:
+ mode_enum = e
+ break
+ if mode_enum:
+ cfg.set(cfg.subtitle_render_mode, mode_enum)
+ self.render_mode_button.setText(mode_text)
+ signalBus.subtitle_render_mode_changed.emit(mode_text)
+
+ def on_render_mode_changed_external(self, mode_text: str):
+ """处理外部渲染模式变更(仅更新 UI)"""
+ self.render_mode_button.setText(mode_text)
+
+ def _update_synthesis_controls_state(self):
+ """更新所有合成相关控件的启用/禁用状态"""
+ need_video = self.need_video_action.isChecked()
+
+ # 合成视频关闭时,禁用所有相关选项
+ self.soft_subtitle_action.setEnabled(need_video)
+ self.use_style_action.setEnabled(need_video)
+ self.video_quality_button.setEnabled(need_video)
+
+ # 渲染模式按钮需要同时满足:合成视频开启 且 使用样式开启
+ self._update_style_controls_state()
+
+ def _update_style_controls_state(self):
+ """更新样式相关控件的启用/禁用状态"""
+ need_video = self.need_video_action.isChecked()
+ use_style = self.use_style_action.isChecked()
+ # 渲染模式按钮:需要合成视频开启 且 使用样式开启
+ self.render_mode_button.setEnabled(need_video and use_style)
+
def choose_subtitle_file(self):
# 构建文件过滤器
subtitle_formats = " ".join(
diff --git a/legacy-docs/README_EN.md b/legacy-docs/README_EN.md
index 5422c1a7..9474a2a7 100644
--- a/legacy-docs/README_EN.md
+++ b/legacy-docs/README_EN.md
@@ -4,22 +4,19 @@
VideoCaptioner
An LLM-powered video subtitle processing assistant, supporting speech recognition, subtitle segmentation, optimization, and translation.
- [简体中文](./README.md) / [正體中文](./docs/README_TW.md) / English / [日本語](./docs/README_JA.md)
+ [简体中文](../README.md) / [正體中文](./README_TW.md) / English / [日本語](./README_JA.md)
## 📖 Introduction
-Kaka Subtitle Assistant (VideoCaptioner) is easy to operate and doesn't require high-end hardware. It supports both online API calls and local offline processing (with GPU support) for speech recognition. It leverages Large Language Models (LLMs) for intelligent subtitle segmentation, correction, and translation. It offers a one-click solution for the entire video subtitle workflow! Add stunning subtitles to your videos.
+Kaka Subtitle Assistant (VideoCaptioner) is easy to operate and doesn't require high-end hardware. It supports both online API calls and local offline processing (with GPU support) for speech recognition. It leverages Large Language Models (LLMs) for intelligent subtitle segmentation, correction, and translation. It offers a one-click solution for the entire video subtitle workflow! Add stunning subtitles to your videos.
-The latest version now supports VAD, vocal separation, word-level timestamps, batch subtitle processing, and other practical features.
-
-- 🎯 No GPU required to use powerful speech recognition engines for accurate subtitle generation.
-- ✂️ LLM-based intelligent segmentation and sentence breaking for more natural subtitle reading.
-- 🔄 AI subtitle multi-threading optimization and translation, adjusting subtitle format and making expressions more idiomatic and professional.
-- 🎬 Supports batch video subtitle synthesis, improving processing efficiency.
-- 📝 Intuitive subtitle editing and viewing interface, supporting real-time preview and quick editing.
-- 🤖 Low model token consumption, and built-in basic LLM model to ensure out-of-the-box use.
+- Support for word-level timestamps and VAD voice activity detection with high recognition accuracy
+- LLM-based semantic understanding to automatically reorganize word-by-word subtitles into natural, fluent sentence paragraphs
+- Context-aware AI translation with reflection optimization mechanism for idiomatic and professional translations
+- Batch video subtitle synthesis support to improve processing efficiency
+- Intuitive subtitle editing and viewing interface with real-time preview and quick editing
## 📸 Interface Preview
@@ -33,11 +30,11 @@ The latest version now supports VAD, vocal separation, word-level timestamps, ba
## 🧪 Testing
-Processing a 14-minute 1080P [English TED video from Bilibili](https://www.bilibili.com/video/BV1jT411X7Dz) end-to-end, using the local Whisper model for speech recognition and the `gpt-4o-mini` model for optimization and translation into Chinese, took approximately **3 minutes**.
+Processing a 14-minute 1080P [English TED video from Bilibili](https://www.bilibili.com/video/BV1jT411X7Dz) end-to-end, using the local Whisper model for speech recognition and the `gpt-5-mini` model for optimization and translation into Chinese, took approximately **4 minutes**.
Based on backend calculations, the cost for model optimization and translation was less than ¥0.01 (calculated using OpenAI's official pricing).
-For detailed results of subtitle and video synthesis, please refer to the [TED Video Test](./docs/test.md).
+For detailed results of subtitle and video synthesis, please refer to the [TED Video Test](./test.md).
## 🚀 Quick Start
@@ -46,98 +43,85 @@ For detailed results of subtitle and video synthesis, please refer to the [TED V
The software is lightweight, with a package size of less than 60MB, and includes all necessary environments. Download and run directly.
-1. Download the latest version of the executable from the [Release](https://github.com/WEIFENG2333/VideoCaptioner/releases) page. Or: [Lanzou Cloud Download](https://wwwm.lanzoue.com/iam1L2n8n3za)
+1. Download the latest version of the executable from the [Release](https://github.com/WEIFENG2333/VideoCaptioner/releases) page. Or: [Lanzou Cloud Download](https://wwwm.lanzoue.com/ii14G2pdsbej)
2. Open the installer to install.
-3. (Optional) LLM API Configuration, choose whether to enable subtitle optimization or subtitle translation.
+3. LLM API Configuration (for subtitle segmentation and correction), you can use [this project's API relay](https://api.videocaptioner.cn)
-4. Drag and drop the video file into the software window for fully automatic processing.
+4. Translation configuration, choose whether to enable translation (default uses Microsoft Translator, average quality, recommend configuring your own API KEY for LLM translation)
-Note: Each step supports independent processing and file drag-and-drop.
+5. Speech recognition configuration (default uses B interface for online speech recognition, use local transcription for languages other than Chinese and English)
-
-For MacOS Users
-
-
-Due to my lack of a Mac, I cannot test and package for MacOS. MacOS executables are temporarily unavailable.
+### For macOS Users
-Mac users, please download the source code and install Python dependencies to run. (Local Whisper functionality is currently not supported on MacOS.)
+#### One-Click Install & Run (Recommended)
-1. Install ffmpeg and Aria2 download tools
```bash
-brew install ffmpeg
-brew install aria2
-brew install python@3.**
-```
+# Method 1: Direct run (auto-installs uv, clones project, installs dependencies)
+curl -fsSL https://raw.githubusercontent.com/WEIFENG2333/VideoCaptioner/main/scripts/run.sh | bash
-2. Clone the project
-```bash
+# Method 2: Clone first, then run
git clone https://github.com/WEIFENG2333/VideoCaptioner.git
cd VideoCaptioner
+./scripts/run.sh
```
-3. Install dependencies
-```bash
-python3.** -m venv venv
-source venv/bin/activate
-pip install -r requirements.txt
-```
+The script will automatically:
-4. Run the program
-```bash
-python main.py
-```
-
+1. Install the [uv](https://docs.astral.sh/uv/) package manager (if not installed)
+2. Clone the project to `~/VideoCaptioner` (if not running from project directory)
+3. Install all Python dependencies
+4. Launch the application
-Docker Deployment (beta)
+Manual Installation Steps
-The current application is relatively basic. We welcome PR contributions.
-
-### 1. Clone the project
+#### 1. Install uv package manager
```bash
-git clone https://github.com/WEIFENG2333/VideoCaptioner.git
-cd VideoCaptioner
+curl -LsSf https://astral.sh/uv/install.sh | sh
```
-### 2. Build the image
+#### 2. Install system dependencies (macOS)
```bash
-docker build -t video-captioner .
+brew install ffmpeg
```
-### 3. Run the container
+#### 3. Clone and run
-Run with custom API configuration:
```bash
-docker run -d \
- -p 8501:8501 \
- -v $(pwd)/temp:/app/temp \
- -e OPENAI_BASE_URL="Your API address" \
- -e OPENAI_API_KEY="Your API key" \
- --name video-captioner \
- video-captioner
+git clone https://github.com/WEIFENG2333/VideoCaptioner.git
+cd VideoCaptioner
+uv sync # Install dependencies
+uv run python main.py # Run
```
-### 4. Access the application
+
-Open your browser and go to: `http://localhost:8501`
+### Developer Guide
-### Notes
+```bash
+# Install dependencies (including dev dependencies)
+uv sync
-- The container already includes necessary dependencies like ffmpeg.
-- If you need to use other models, please configure them through environment variables.
+# Run application
+uv run python main.py
-
+# Type checking
+uv run pyright
+
+# Code linting
+uv run ruff check .
+```
## ✨ Main Features
-The software fully utilizes the advantages of Large Language Models (LLMs) in understanding context to further process subtitles generated by speech recognition. It effectively corrects typos, unifies terminology, and makes the subtitle content more accurate and coherent, providing users with an excellent viewing experience!
+The software fully utilizes the advantages of Large Language Models (LLMs) in understanding context to further process subtitles generated by speech recognition. It effectively corrects typos, unifies terminology, and makes the subtitle content more accurate and coherent, providing users with an excellent viewing experience!
#### 1. Multi-platform Video Download and Processing
-- Supports mainstream video platforms at home and abroad (Bilibili, YouTube, etc.)
+- Supports mainstream video platforms (Bilibili, YouTube, TikTok, X, etc.)
- Automatically extracts and processes the original subtitles of the video.
#### 2. Professional Speech Recognition Engine
@@ -161,17 +145,67 @@ The software fully utilizes the advantages of Large Language Models (LLMs) in un
## ⚙️ Basic Configuration
-### 1. LLM API Configuration Instructions (Optional)
+### 1. LLM API Configuration Instructions
+
+LLM is used for subtitle segmentation, optimization, and translation (if LLM translation is selected).
| Configuration Item | Description |
|--------|------|
-| Built-in Model | The software includes a basic large language model (`gpt-4o-mini`), which can be used without configuration (public service is unstable). |
-| API Support | Supports standard OpenAI API format. Compatible with [SiliconCloud](https://cloud.siliconflow.cn/i/HF95kaoz), [DeepSeek](https://platform.deepseek.com/), [Ollama](https://ollama.com/blog/openai-compatibility), etc.
For configuration methods, please refer to the [Configuration Documentation](./docs/llm_config.md). |
+| SiliconCloud | [SiliconCloud Official](https://cloud.siliconflow.cn/i/onCHcaDx), for configuration see [online docs](https://weifeng2333.github.io/VideoCaptioner/config/llm)
Low concurrency, recommend setting threads below 5. |
+| DeepSeek | [DeepSeek Official](https://platform.deepseek.com), recommend using `deepseek-v3` model. |
+| OpenAI Compatible | If you have API from other providers, fill in directly. base_url and api_key [VideoCaptioner API](https://api.videocaptioner.cn) |
+
+Note: If your API provider doesn't support high concurrency, lower the "thread count" in settings to avoid request errors.
+
+---
+
+For high concurrency, or to use quality models like OpenAI or Claude for subtitle correction and translation:
+
+Use this project's ✨LLM API Relay✨: [https://api.videocaptioner.cn](https://api.videocaptioner.cn)
+
+Supports high concurrency, excellent value, with many domestic and international models available.
+
+After registering and getting your key, configure settings as follows:
+
+BaseURL: `https://api.videocaptioner.cn/v1`
+
+API-key: `Get from Personal Center - API Token page.`
+
+💡 Model Selection Recommendations (high-value models selected at each quality tier):
+
+- High quality: `gemini-3-pro`, `claude-sonnet-4-5-20250929` (cost ratio: 3)
+
+- Higher quality: `gpt-5-2025-08-07`, `claude-haiku-4-5-20251001` (cost ratio: 1.2)
+
+- Medium quality: `gpt-5-mini`, `gemini-3-flash` (cost ratio: 0.3)
+
+This site supports ultra-high concurrency, max out the thread count in the software~ Processing speed is very fast~
+
+For more detailed API configuration tutorial: [API Configuration](https://weifeng2333.github.io/VideoCaptioner/config/llm)
+
+---
+
+### 2. Translation Configuration
+
+| Configuration Item | Description |
+| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| LLM Translation | 🌟 Best translation quality. Uses AI large models for translation, better context understanding, more natural translations. Requires LLM API configuration (e.g., OpenAI, DeepSeek, etc.) |
+| Microsoft Translator | Uses Microsoft's translation service, very fast |
+| Google Translate | Google's translation service, fast, but requires access to Google's network |
+
+Recommended: `LLM Translation` for the best translation quality.
+
+### 3. Speech Recognition Interface Description
-Recommended models: For higher quality, choose `Claude-3.5-sonnet` or `gpt-4o`.
+| Interface Name | Supported Languages | Running Mode | Description |
+|---------|---------|---------|------|
+| Interface B | Chinese, English only | Online | Free, fast |
+| Interface J | Chinese, English only | Online | Free, fast |
+| WhisperCpp | Chinese, Japanese, Korean, English, and 99 other languages. Good performance for foreign languages. | Local | (Actual use is unstable) Requires downloading transcription models.
Chinese: Medium or larger model recommended.
English, etc.: Smaller models can achieve good results. |
+| fasterWhisper 👍 | Chinese, English, and 99 other languages. Excellent performance for foreign languages, more accurate timeline. | Local | (🌟Recommended🌟) Requires downloading the program and transcription models.
Supports CUDA, faster, accurate transcription.
Super accurate timestamp subtitles.
Windows only |
-### 2. Local Whisper Speech Recognition Configuration (Requires download within the software)
+### 4. Local Whisper Speech Recognition Configuration (Requires download within the software)
There are two Whisper versions: WhisperCpp and fasterWhisper (recommended). The latter has better performance and both require downloading models within the software.
@@ -180,46 +214,34 @@ There are two Whisper versions: WhisperCpp and fasterWhisper (recommended). The
| Tiny | 75 MiB | ~273 MB | Transcription is mediocre, for testing only. |
| Small | 466 MiB | ~852 MB | English recognition is already good. |
| Medium | 1.5 GiB | ~2.1 GB | This version is recommended as the minimum for Chinese recognition. |
-| Large-v1/v2 👍 | 2.9 GiB | ~3.9 GB | Good performance, recommended if your configuration allows. |
+| Large-v2 👍 | 2.9 GiB | ~3.9 GB | Good performance, recommended if your configuration allows. |
| Large-v3 | 2.9 GiB | ~3.9 GB | Community feedback suggests potential hallucination/subtitle repetition issues. |
-Recommended model: Large-v1 is stable and of good quality.
+Recommended model: `Large-v2` is stable and of good quality.
-Note: The above models can be downloaded directly within the software using a domestic network; both GPU and integrated graphics are supported.
-
-### 3. Manuscript Matching
+### 5. Manuscript Matching
- On the "Subtitle Optimization and Translation" page, there is a "Manuscript Matching" option, which supports the following **one or more** types of content to assist in subtitle correction and translation:
| Type | Description | Example |
|------|------|------|
-| Glossary | Correction table for terminology, names, and specific words. | 机器学习->Machine Learning
马斯克->Elon Musk
打call -> Cheer on
Turing patterns
Bus paradox |
+| Glossary | Correction table for terminology, names, and specific words. | Machine Learning->机器学习
Elon Musk->马斯克
Turing patterns
Bus paradox |
| Original Subtitle Text | The original manuscript or related content of the video. | Complete speech scripts, lecture notes, etc. |
| Correction Requirements | Specific correction requirements related to the content. | Unify personal pronouns, standardize terminology, etc.
Fill in requirements **related to the content**, [example reference](https://github.com/WEIFENG2333/VideoCaptioner/issues/59#issuecomment-2495849752) |
- If you need manuscript assistance for subtitle optimization, fill in the manuscript information first, then start the task processing.
-- Note: When using small LLM models with limited context, it is recommended to keep the manuscript content within 1000 words. If using a model with a larger context window, you can appropriately increase the manuscript content.
-
-
-### 4. Speech Recognition Interface Description
-
-| Interface Name | Supported Languages | Running Mode | Description |
-|---------|---------|---------|------|
-| Interface B | Chinese, English | Online | Free, fast |
-| Interface J | Chinese, English | Online | Free, fast |
-| WhisperCpp | Chinese, Japanese, Korean, English, and 99 other languages. Good performance for foreign languages. | Local | (Actual use is unstable) Requires downloading transcription models.
Chinese: Medium or larger model recommended.
English, etc.: Smaller models can achieve good results. |
-| fasterWhisper 👍 | Chinese, English, and 99 other languages. Excellent performance for foreign languages, more accurate timeline. | Local | (🌟Highly Recommended🌟) Requires downloading the program and transcription models.
Supports CUDA, faster, accurate transcription.
Super accurate timestamp subtitles.
Prioritize using this. |
+- Note: When using small LLM models with limited context, it is recommended to keep the manuscript content within 1000 words. If using a model with a larger context window, you can appropriately increase the manuscript content.
-### 5. Cookie Configuration Instructions
+### 6. Cookie Configuration Instructions
If you encounter the following situations when using the URL download function:
1. The video website requires login information to download.
2. Only lower resolution videos can be downloaded.
3. Verification is required when network conditions are poor.
-- Please refer to the [Cookie Configuration Instructions](./docs/get_cookies.md) to obtain cookie information and place the `cookies.txt` file in the `AppData` directory of the software installation directory to download high-quality videos normally.
+- Please refer to the [Cookie Configuration Instructions](https://weifeng2333.github.io/VideoCaptioner/guide/cookies-config) to obtain cookie information and place the `cookies.txt` file in the `AppData` directory of the software installation directory to download high-quality videos normally.
## 💡 Software Process Introduction
@@ -228,119 +250,49 @@ The simple processing flow of the program is as follows:
Speech Recognition -> Subtitle Segmentation (optional) -> Subtitle Optimization & Translation (optional) -> Subtitle & Video Synthesis
```
-The main directory structure after installing the software is as follows:
+The main directory structure of the project is as follows:
```
VideoCaptioner/
-├── runtime/ # Runtime environment directory (do not modify)
-├── resources/ # Software resource file directory (binaries, icons, etc., and downloaded faster-whisper program)
-├── work-dir/ # Working directory, where processed videos and subtitle files are saved
+├── app/ # Application source code directory
+│ ├── common/ # Common modules (config, signal bus)
+│ ├── components/ # UI components
+│ ├── core/ # Core business logic (ASR, translation, optimization, etc.)
+│ ├── thread/ # Async threads
+│ └── view/ # Interface views
+├── resource/ # Resource file directory
+│ ├── assets/ # Icons, Logo, etc.
+│ ├── bin/ # Binary programs (FFmpeg, Whisper, etc.)
+│ ├── fonts/ # Font files
+│ ├── subtitle_style/ # Subtitle style templates
+│ └── translations/ # Multi-language translation files
+├── work-dir/ # Working directory (processed videos and subtitles)
├── AppData/ # Application data directory
- ├── cache/ # Cache directory, caching transcription and large model request data.
- ├── models/ # Stores Whisper model files
- ├── logs/ # Log directory, recording software running status
- ├── settings.json # Stores user settings
- └── cookies.txt # Cookie information for video platforms (required for downloading high-definition videos)
-└── VideoCaptioner.exe # Main program executable file
+│ ├── cache/ # Cache directory (transcription, LLM requests)
+│ ├── models/ # Whisper model files
+│ ├── logs/ # Log files
+│ └── settings.json # User settings
+├── scripts/ # Installation and run scripts
+├── main.py # Program entry
+└── pyproject.toml # Project configuration and dependencies
```
## 📝 Notes
-1. The quality of subtitle segmentation is crucial for the viewing experience. For this, I developed [SubtitleSpliter](https://github.com/WEIFENG2333/SubtitleSpliter), which can intelligently reorganize word-by-word subtitles into paragraphs that conform to natural language habits and perfectly synchronize with the video frames.
+1. The quality of subtitle segmentation is crucial for the viewing experience. The software can intelligently reorganize word-by-word subtitles into paragraphs that conform to natural language habits and perfectly synchronize with the video frames.
2. During processing, only the text content is sent to the large language model, without timeline information, which greatly reduces processing overhead.
-3. In the translation stage, we adopt the "translate-reflect-translate" methodology proposed by Andrew Ng. This iterative optimization method not only ensures the accuracy of the translation.
-
-## 🤝 Contribution Guidelines
-
-The author is a junior college student. Both my personal abilities and the project have many shortcomings. The project is also constantly being improved. If you encounter any bugs during use, please feel free to submit [Issues](https://github.com/WEIFENG2333/VideoCaptioner/issues) and Pull Requests to help improve the project.
-
-## Update Log
+3. In the translation stage, we adopt the "translate-reflect-translate" methodology proposed by Andrew Ng. This iterative optimization method ensures the accuracy of the translation.
-
-2024.1.22
-
-### Core Feature Enhancements
-- Complete code architecture refactoring, optimizing overall performance
-- Subtitle optimization and translation function modules are separated, providing more flexible processing options
-- Added batch processing function: supports batch subtitles, batch transcription, batch subtitle video synthesis
-- Comprehensive optimization of UI interface and interaction details
-
-### AI Model and Translation Upgrades
-- Expanded LLM support: Added SiliconCloud, DeepSeek, Ollama, Gemini, ChatGLM, and other models
-- Integrated multiple translation services: DeepLx, Bing, Google, LLM
-- Added faster-whisper-large-v3-turbo model support
-- Added multiple VAD (Voice Activity Detection) methods
-- Support custom reflection translation switch
-- Subtitle segmentation supports semantic/sentence modes
-- Optimization of prompts for subtitle segmentation, optimization, and translation
-- Optimization of subtitle and transcription caching mechanism
-- Improved automatic line wrapping for Chinese subtitles
-- Added vertical subtitle style
-- Improved subtitle timeline switching mechanism to eliminate flickering issues
-
-### Bug Fixes and Other Improvements
-- Fixed the issue where Whisper API could not be used
-- Added support for multiple subtitle video formats
-- Fixed the problem of transcription errors in some cases
-- Optimized video working directory structure
-- Added log viewing function
-- Added subtitle optimization for Thai, German, and other languages
-- Fixed many bugs...
-
-
+4. When processing YouTube links, video subtitles are automatically downloaded, saving the transcription step and significantly reducing operation time.
+## 🤝 Contribution Guidelines
-
-2024.12.07
-
-- Added Faster-whisper support, better audio-to-subtitle quality
-- Support for Vad voice breakpoint detection, greatly reducing hallucination phenomena
-- Support for vocal separation, separating video background noise
-- Support for turning off video synthesis
-- Added maximum subtitle length setting
-- Added setting to remove punctuation at the end of subtitles
-- Optimization of prompts for optimization and translation
-- Optimized LLM subtitle segmentation errors
-- Fixed inconsistent audio conversion format issues
-
-
-
-
-2024.11.23
-
-- Added Whisper-v3 model support, greatly improving speech recognition accuracy
-- Optimized subtitle segmentation algorithm, providing a more natural reading experience
-- Fixed stability issues when detecting model availability
-
-
-
-2024.11.20
-
-- Support custom adjustment of subtitle position and style
-- Added real-time log viewing for the subtitle optimization and translation process
-- Fixed automatic translation issues when using the API
-- Optimized video working directory structure, improving file management efficiency
-
-
-
-2024.11.17
+The project is constantly being improved. If you encounter any bugs during use, please feel free to submit [Issues](https://github.com/WEIFENG2333/VideoCaptioner/issues) and Pull Requests to help improve the project.
-- Support flexible export of bilingual/monolingual subtitles
-- Added alignment function for manuscript matching prompts
-- Fixed stability issues when importing subtitles
-- Fixed compatibility issues with non-Chinese paths for model downloads
-
+## 📝 Changelog
-
-2024.11.13
-
-- Added Whisper API call support
-- Support importing cookie.txt to download resources from major video platforms
-- Subtitle file names are automatically consistent with video file names
-- Added real-time viewing of running logs on the software homepage
-- Unified and improved internal software functions
-
+View the complete update history at [CHANGELOG.md](../CHANGELOG.md)
## ⭐ Star History
@@ -348,9 +300,12 @@ The author is a junior college student. Both my personal abilities and the proje
## 💖 Support the Author
-If you find this project helpful, please give it a Star. This will be the greatest encouragement and support for me!
+If you find this project helpful, please give it a Star!
+
+Donation Support

-
\ No newline at end of file
+
+
diff --git a/legacy-docs/README_JA.md b/legacy-docs/README_JA.md
index 1ac1f9e7..5cbec020 100644
--- a/legacy-docs/README_JA.md
+++ b/legacy-docs/README_JA.md
@@ -4,7 +4,7 @@
VideoCaptioner
音声認識、字幕のセグメンテーション、最適化、翻訳をサポートするLLM駆動のビデオ字幕処理アシスタント。
- [简体中文](./README.md) / [正體中文](./docs/README_TW.md) / [English](./docs/READNE_EN.md) / 日本語
+ [简体中文](../README.md) / [正體中文](./README_TW.md) / [English](./README_EN.md) / 日本語
@@ -12,14 +12,11 @@
Kaka 字幕アシスタント(VideoCaptioner)は操作が簡単で、高性能なハードウェアを必要としません。音声認識のためのオンラインAPI呼び出しとローカルオフライン処理(GPUサポートあり)の両方をサポートしています。大規模言語モデル(LLM)を活用して、インテリジェントな字幕のセグメンテーション、修正、翻訳を行います。ビデオ字幕のワークフロー全体をワンクリックで解決します!あなたのビデオに素晴らしい字幕を追加しましょう。
-最新バージョンでは、VAD、ボーカル分離、単語レベルのタイムスタンプ、バッチ字幕処理、その他の実用的な機能をサポートしています。
-
-- 🎯 強力な音声認識エンジンを使用するためにGPUは不要で、正確な字幕生成が可能です。
-- ✂️ LLMベースのインテリジェントなセグメンテーションと文の分割で、より自然な字幕の読み取りを実現。
-- 🔄 AI字幕のマルチスレッド最適化と翻訳、字幕形式の調整、表現をより慣用的かつプロフェッショナルに。
-- 🎬 バッチビデオ字幕合成をサポートし、処理効率を向上。
-- 📝 直感的な字幕編集と表示インターフェース、リアルタイムプレビューと迅速な編集をサポート。
-- 🤖 低モデルトークン消費、基本的なLLMモデルを内蔵し、すぐに使用可能。
+- 単語レベルのタイムスタンプとVAD音声活動検出をサポートし、高い認識精度を実現
+- LLMベースの意味理解により、単語ごとの字幕を自然で流暢な文章段落に自動再構成
+- 文脈を考慮したAI翻訳、反映最適化メカニズムにより、慣用的でプロフェッショナルな翻訳を実現
+- バッチビデオ字幕合成をサポートし、処理効率を向上
+- 直感的な字幕編集と表示インターフェース、リアルタイムプレビューとクイック編集をサポート
## 📸 インターフェースプレビュー
@@ -32,11 +29,11 @@ Kaka 字幕アシスタント(VideoCaptioner)は操作が簡単で、高性
## 🧪 テスト
-14分の1080P [Bilibiliの英語TEDビデオ](https://www.bilibili.com/video/BV1jT411X7Dz)をエンドツーエンドで処理し、ローカルWhisperモデルを使用して音声認識を行い、`gpt-4o-mini`モデルを使用して中国語に最適化および翻訳するのに約**3分**かかりました。
+14分の1080P [Bilibiliの英語TEDビデオ](https://www.bilibili.com/video/BV1jT411X7Dz)をエンドツーエンドで処理し、ローカルWhisperモデルを使用して音声認識を行い、`gpt-5-mini`モデルを使用して中国語に最適化および翻訳するのに約**4分**かかりました。
バックエンドの計算に基づくと、モデルの最適化と翻訳のコストは¥0.01未満でした(OpenAIの公式価格を使用して計算)。
-字幕とビデオ合成の詳細な結果については、[TEDビデオテスト](./docs/test.md)を参照してください。
+字幕とビデオ合成の詳細な結果については、[TEDビデオテスト](./test.md)を参照してください。
## 🚀 クイックスタート
@@ -45,98 +42,85 @@ Kaka 字幕アシスタント(VideoCaptioner)は操作が簡単で、高性
このソフトウェアは軽量で、パッケージサイズは60MB未満であり、必要な環境がすべて含まれています。ダウンロードして直接実行できます。
-1. [リリースページ](https://github.com/WEIFENG2333/VideoCaptioner/releases)から最新バージョンの実行ファイルをダウンロードします。または:[Lanzou Cloud Download](https://wwwm.lanzoue.com/iam1L2n8n3za)
+1. [リリースページ](https://github.com/WEIFENG2333/VideoCaptioner/releases)から最新バージョンの実行ファイルをダウンロードします。または:[Lanzou Cloud Download](https://wwwm.lanzoue.com/ii14G2pdsbej)
2. インストーラーを開いてインストールします。
-3. (オプション)LLM API設定、字幕の最適化または翻訳を有効にするかどうかを選択します。
-
-4. ソフトウェアウィンドウにビデオファイルをドラッグアンドドロップして、完全自動処理を行います。
+3. LLM API設定(字幕のセグメンテーションと修正用)、[このプロジェクトのAPIリレー](https://api.videocaptioner.cn)を使用できます
-注意:各ステップは独立した処理とファイルのドラッグアンドドロップをサポートしています。
+4. 翻訳設定、翻訳を有効にするかどうかを選択(デフォルトはMicrosoft翻訳、品質は普通、LLM翻訳用に自分のAPI KEYを設定することを推奨)
-
-MacOSユーザー向け
+5. 音声認識設定(デフォルトはBインターフェースでオンライン音声認識、中国語と英語以外の言語にはローカル文字起こしを使用)
-開発者がMacを持っていないため、MacOSでのテストとパッケージ化ができません。MacOS用の実行ファイルは一時的に利用できません。
+### macOSユーザー向け
-Macユーザーは、ソースコードをダウンロードし、Pythonの依存関係をインストールして実行してください。(ローカルWhisper機能は現在MacOSではサポートされていません。)
+#### ワンクリックインストール&実行(推奨)
-1. ffmpegとAria2ダウンロードツールをインストール
```bash
-brew install ffmpeg
-brew install aria2
-brew install python@3.**
-```
+# 方法1:直接実行(自動的にuv、プロジェクトのクローン、依存関係のインストール)
+curl -fsSL https://raw.githubusercontent.com/WEIFENG2333/VideoCaptioner/main/scripts/run.sh | bash
-2. プロジェクトをクローン
-```bash
+# 方法2:先にクローンしてから実行
git clone https://github.com/WEIFENG2333/VideoCaptioner.git
cd VideoCaptioner
+./scripts/run.sh
```
-3. 依存関係をインストール
-```bash
-python3.** -m venv venv
-source venv/bin/activate
-pip install -r requirements.txt
-```
-
-4. プログラムを実行
-```bash
-python main.py
-```
-
+スクリプトは自動的に:
+1. [uv](https://docs.astral.sh/uv/)パッケージマネージャーをインストール(未インストールの場合)
+2. プロジェクトを`~/VideoCaptioner`にクローン(プロジェクトディレクトリから実行していない場合)
+3. すべてのPython依存関係をインストール
+4. アプリケーションを起動
-Docker デプロイメント (ベータ版)
-
-現在のアプリケーションは比較的基本的なものです。PRの貢献を歓迎します。
+手動インストール手順
-### 1. プロジェクトをクローン
+#### 1. uvパッケージマネージャーをインストール
```bash
-git clone https://github.com/WEIFENG2333/VideoCaptioner.git
-cd VideoCaptioner
+curl -LsSf https://astral.sh/uv/install.sh | sh
```
-### 2. イメージをビルド
+#### 2. システム依存関係をインストール(macOS)
```bash
-docker build -t video-captioner .
+brew install ffmpeg
```
-### 3. コンテナを実行
+#### 3. クローンして実行
-カスタムAPI設定で実行:
```bash
-docker run -d \
- -p 8501:8501 \
- -v $(pwd)/temp:/app/temp \
- -e OPENAI_BASE_URL="Your API address" \
- -e OPENAI_API_KEY="Your API key" \
- --name video-captioner \
- video-captioner
+git clone https://github.com/WEIFENG2333/VideoCaptioner.git
+cd VideoCaptioner
+uv sync # 依存関係をインストール
+uv run python main.py # 実行
```
-### 4. アプリケーションにアクセス
+
+
+### 開発者ガイド
-ブラウザを開いて、`http://localhost:8501`にアクセスしてください。
+```bash
+# 依存関係をインストール(開発依存関係を含む)
+uv sync
-### 注意事項
+# アプリケーションを実行
+uv run python main.py
-- コンテナにはffmpegなどの必要な依存関係がすでに含まれています。
-- 他のモデルを使用する必要がある場合は、環境変数を通じて設定してください。
+# 型チェック
+uv run pyright
-
+# コードリンティング
+uv run ruff check .
+```
## ✨ 主要機能
このソフトウェアは、大規模言語モデル(LLM)の文脈理解の利点を最大限に活用し、音声認識で生成された字幕をさらに処理します。誤字を効果的に修正し、用語を統一し、字幕の内容をより正確で一貫性のあるものにし、ユーザーに優れた視聴体験を提供します!
#### 1. マルチプラットフォーム動画ダウンロードと処理
-- 国内外の主流のビデオプラットフォーム(Bilibili、YouTubeなど)をサポート
+- 国内外の主流のビデオプラットフォーム(Bilibili、YouTube、TikTok、Xなど)をサポート
- ビデオの元の字幕を自動的に抽出して処理します。
#### 2. プロフェッショナルな音声認識エンジン
@@ -159,16 +143,66 @@ docker run -d \
## ⚙️ 基本設定
-### 1. LLM API設定手順(任意)
+### 1. LLM API設定手順
+
+LLMは字幕のセグメンテーション、最適化、翻訳(LLM翻訳を選択した場合)に使用されます。
| 設定項目 | 説明 |
|--------|------|
-| 内蔵モデル | ソフトウェアには基本的な大規模言語モデル(`gpt-4o-mini`)が含まれており、設定なしで使用可能です(公共サービスは不安定です)。 |
-| APIサポート | 標準のOpenAI API形式をサポート。 [SiliconCloud](https://cloud.siliconflow.cn/i/HF95kaoz)、[DeepSeek](https://platform.deepseek.com/)、[Ollama](https://ollama.com/blog/openai-compatibility)などと互換性があります。
設定方法については、[設定ドキュメント](./docs/llm_config.md)を参照してください。 |
+| SiliconCloud | [SiliconCloud公式](https://cloud.siliconflow.cn/i/onCHcaDx)、設定については[オンラインドキュメント](https://weifeng2333.github.io/VideoCaptioner/config/llm)を参照
並行性が低いため、スレッド数を5以下に設定することを推奨。 |
+| DeepSeek | [DeepSeek公式](https://platform.deepseek.com)、`deepseek-v3`モデルの使用を推奨。 |
+| OpenAI互換 | 他のプロバイダーからのAPIがある場合は、直接入力してください。base_urlとapi_key [VideoCaptioner API](https://api.videocaptioner.cn) |
+
+注意:APIプロバイダーが高並行性をサポートしていない場合は、設定で「スレッド数」を下げてリクエストエラーを回避してください。
+
+---
+
+高並行性、またはOpenAIやClaudeなどの高品質モデルを字幕修正と翻訳に使用する場合:
+
+このプロジェクトの✨LLM APIリレー✨を使用:[https://api.videocaptioner.cn](https://api.videocaptioner.cn)
+
+高並行性をサポートし、優れた価値を提供し、国内外の多くのモデルが利用可能です。
+
+登録してキーを取得後、以下のように設定を構成します:
+
+BaseURL: `https://api.videocaptioner.cn/v1`
+
+API-key: `個人センター - APIトークンページから取得。`
+
+💡 モデル選択の推奨(各品質層で選ばれた高価値モデル):
+
+- 高品質:`gemini-3-pro`、`claude-sonnet-4-5-20250929`(コスト比:3)
+
+- より高品質:`gpt-5-2025-08-07`、`claude-haiku-4-5-20251001`(コスト比:1.2)
+
+- 中品質:`gpt-5-mini`、`gemini-3-flash`(コスト比:0.3)
+
+このサイトは超高並行性をサポートしています。ソフトウェアのスレッド数を最大にしてください~処理速度は非常に速いです~
+
+詳細なAPI設定チュートリアル:[API設定](https://weifeng2333.github.io/VideoCaptioner/config/llm)
+
+---
+
+### 2. 翻訳設定
-推奨モデル:より高品質を求める場合は、`Claude-3.5-sonnet`または`gpt-4o`を選択してください。
+| 設定項目 | 説明 |
+| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| LLM翻訳 | 🌟 最高の翻訳品質。AI大規模モデルを使用した翻訳、より良い文脈理解、より自然な翻訳。LLM API設定が必要(例:OpenAI、DeepSeekなど) |
+| Microsoft翻訳 | Microsoftの翻訳サービスを使用、非常に高速 |
+| Google翻訳 | Googleの翻訳サービス、高速、ただしGoogleのネットワークへのアクセスが必要 |
+
+推奨:最高の翻訳品質には`LLM翻訳`。
+
+### 3. 音声認識インターフェースの説明
+
+| インターフェース名 | 対応言語 | 実行方式 | 説明 |
+|---------|---------|---------|------|
+| インターフェースB | 中国語、英語のみ | オンライン | 無料、高速 |
+| インターフェースJ | 中国語、英語のみ | オンライン | 無料、高速 |
+| WhisperCpp | 中国語、日本語、韓国語、英語、その他99の言語。外国語に対して良好なパフォーマンス。 | ローカル | (実際の使用は不安定)トランスクリプションモデルのダウンロードが必要。
中国語:中型以上のモデルを推奨。
英語など:小型モデルでも良好な結果が得られます。 |
+| fasterWhisper 👍 | 中国語、英語、その他99の言語。外国語に対して優れたパフォーマンス、より正確なタイムライン。 | ローカル | (🌟推奨🌟)プログラムとトランスクリプションモデルのダウンロードが必要。
CUDAをサポートし、より高速で正確なトランスクリプション。
非常に正確なタイムスタンプ字幕。
Windowsのみ |
-### 2. ローカルWhisper音声認識設定(ソフトウェア内でダウンロードが必要)
+### 4. ローカルWhisper音声認識設定(ソフトウェア内でダウンロードが必要)
Whisperには2つのバージョンがあります:WhisperCppとfasterWhisper(推奨)。後者はより良いパフォーマンスを持ち、どちらもソフトウェア内でモデルをダウンロードする必要があります。
@@ -177,44 +211,33 @@ Whisperには2つのバージョンがあります:WhisperCppとfasterWhisper
| Tiny | 75 MiB | ~273 MB | トランスクリプションは平均的で、テストのみを目的としています。 |
| Small | 466 MiB | ~852 MB | 英語の認識はすでに良好です。 |
| Medium | 1.5 GiB | ~2.1 GB | 中国語の認識にはこのバージョンが最低限推奨されます。 |
-| Large-v1/v2 👍 | 2.9 GiB | ~3.9 GB | 良好なパフォーマンスを持ち、設定が許すなら推奨されます。 |
+| Large-v2 👍 | 2.9 GiB | ~3.9 GB | 良好なパフォーマンスを持ち、設定が許すなら推奨されます。 |
| Large-v3 | 2.9 GiB | ~3.9 GB | コミュニティのフィードバックによると、幻覚/字幕の繰り返しの問題がある可能性があります。 |
-推奨モデル:Large-v1は安定しており、品質が良好です。
-
-注意:上記のモデルは、ソフトウェア内で直接ダウンロード可能で、国内ネットワークを使用し、GPUと統合グラフィックスの両方をサポートしています。
+推奨モデル:`Large-v2`は安定しており、品質が良好です。
-### 3. 原稿マッチング
+### 5. 原稿マッチング
- 「字幕の最適化と翻訳」ページには「原稿マッチング」オプションがあり、以下の**1つ以上**のタイプのコンテンツをサポートして字幕の修正と翻訳を支援します:
| タイプ | 説明 | 例 |
|------|------|------|
-| 用語集 | 用語、名前、特定の単語の修正表。 | 机器学习->Machine Learning
马斯克->Elon Musk
打call -> Cheer on
Turing patterns
Bus paradox |
+| 用語集 | 用語、名前、特定の単語の修正表。 | Machine Learning->机器学习
Elon Musk->马斯克
Turing patterns
Bus paradox |
| 元の字幕テキスト | ビデオの元の原稿または関連するコンテンツ。 | 完全なスピーチスクリプト、講義ノートなど。 |
| 修正要件 | コンテンツに関連する特定の修正要件。 | 人称代名詞の統一、用語の標準化など。
**コンテンツに関連する**要件を記入してください。[例の参照](https://github.com/WEIFENG2333/VideoCaptioner/issues/59#issuecomment-2495849752) |
- 字幕の最適化に原稿の支援が必要な場合は、まず原稿情報を記入し、タスク処理を開始してください。
- 注意:コンテキストが限られている小さなLLMモデルを使用する場合、原稿の内容は1000語以内にすることをお勧めします。より大きなコンテキストウィンドウを持つモデルを使用する場合は、原稿の内容を適切に増やすことができます。
-### 4. 音声認識インターフェースの説明
-
-| インターフェース名 | 対応言語 | 実行方式 | 説明 |
-|---------|---------|---------|------|
-| インターフェースB | 中国語、英語 | オンライン | 無料、高速 |
-| インターフェースJ | 中国語、英語 | オンライン | 無料、高速 |
-| WhisperCpp | 中国語、日本語、韓国語、英語、その他99の言語。外国語に対して良好なパフォーマンス。 | ローカル | (実際の使用は不安定)トランスクリプションモデルのダウンロードが必要。
中国語:中型以上のモデルを推奨。
英語など:小型モデルでも良好な結果が得られます。 |
-| fasterWhisper 👍 | 中国語、英語、その他99の言語。外国語に対して優れたパフォーマンス、より正確なタイムライン。 | ローカル | (🌟非常に推奨🌟)プログラムとトランスクリプションモデルのダウンロードが必要。
CUDAをサポートし、より高速で正確なトランスクリプション。
非常に正確なタイムスタンプ字幕。
これを優先して使用してください。 |
-
-### 5. Cookie設定手順
+### 6. Cookie設定手順
URLダウンロード機能を使用する際に以下の状況に遭遇した場合:
1. ビデオサイトがダウンロードにログイン情報を要求する。
2. 低解像度のビデオしかダウンロードできない。
3. ネットワーク状況が悪いときに認証が必要。
-- [Cookie設定手順](./docs/get_cookies.md)を参照して、cookie情報を取得し、`cookies.txt`ファイルをソフトウェアのインストールディレクトリの`AppData`ディレクトリに配置して、高品質のビデオを通常通りダウンロードしてください。
+- [Cookie設定手順](https://weifeng2333.github.io/VideoCaptioner/guide/cookies-config)を参照して、cookie情報を取得し、`cookies.txt`ファイルをソフトウェアのインストールディレクトリの`AppData`ディレクトリに配置して、高品質のビデオを通常通りダウンロードしてください。
## 💡 ソフトウェアプロセスの紹介
@@ -223,118 +246,49 @@ URLダウンロード機能を使用する際に以下の状況に遭遇した
音声認識 -> 字幕セグメンテーション(オプション) -> 字幕の最適化と翻訳(オプション) -> 字幕とビデオの合成
```
-ソフトウェアをインストールした後の主なディレクトリ構造は以下の通りです:
+プロジェクトの主なディレクトリ構造は以下の通りです:
```
VideoCaptioner/
-├── runtime/ # ランタイム環境ディレクトリ(変更しないでください)
-├── resources/ # ソフトウェアリソースファイルディレクトリ(バイナリ、アイコンなど、およびダウンロードされたfaster-whisperプログラム)
-├── work-dir/ # 作業ディレクトリ、処理されたビデオと字幕ファイルが保存されます
+├── app/ # アプリケーションソースコードディレクトリ
+│ ├── common/ # 共通モジュール(設定、シグナルバス)
+│ ├── components/ # UIコンポーネント
+│ ├── core/ # コアビジネスロジック(ASR、翻訳、最適化など)
+│ ├── thread/ # 非同期スレッド
+│ └── view/ # インターフェースビュー
+├── resource/ # リソースファイルディレクトリ
+│ ├── assets/ # アイコン、ロゴなど
+│ ├── bin/ # バイナリプログラム(FFmpeg、Whisperなど)
+│ ├── fonts/ # フォントファイル
+│ ├── subtitle_style/ # 字幕スタイルテンプレート
+│ └── translations/ # 多言語翻訳ファイル
+├── work-dir/ # 作業ディレクトリ(処理されたビデオと字幕)
├── AppData/ # アプリケーションデータディレクトリ
- ├── cache/ # キャッシュディレクトリ、トランスクリプションと大規模モデルのリクエストデータをキャッシュします。
- ├── models/ # Whisperモデルファイルを保存
- ├── logs/ # ログディレクトリ、ソフトウェアの実行状態を記録
- ├── settings.json # ユーザー設定を保存
- └── cookies.txt # ビデオプラットフォームのcookie情報(高解像度ビデオのダウンロードに必要)
-└── VideoCaptioner.exe # メインプログラム実行ファイル
+│ ├── cache/ # キャッシュディレクトリ(トランスクリプション、LLMリクエスト)
+│ ├── models/ # Whisperモデルファイル
+│ ├── logs/ # ログファイル
+│ └── settings.json # ユーザー設定
+├── scripts/ # インストールと実行スクリプト
+├── main.py # プログラムエントリー
+└── pyproject.toml # プロジェクト設定と依存関係
```
## 📝 注意事項
-1. 字幕セグメンテーションの品質は視聴体験にとって非常に重要です。このため、[SubtitleSpliter](https://github.com/WEIFENG2333/SubtitleSpliter)を開発しました。これは、単語ごとの字幕を自然言語の習慣に従って段落に再編成し、ビデオフレームと完全に同期させることができます。
+1. 字幕セグメンテーションの品質は視聴体験にとって非常に重要です。ソフトウェアは単語ごとの字幕を自然言語の習慣に従って段落に再編成し、ビデオフレームと完全に同期させることができます。
2. 処理中、タイムライン情報なしでテキストコンテンツのみが大規模言語モデルに送信され、処理のオーバーヘッドが大幅に削減されます。
3. 翻訳段階では、Andrew Ngが提案した「翻訳-反映-翻訳」手法を採用しています。この反復的な最適化方法は、翻訳の正確性を保証します。
-## 🤝 貢献ガイドライン
-
-作者は大学3年生で、個人の能力とプロジェクトにはまだ多くの改善の余地があります。プロジェクトは継続的に改善中で、使用中にバグに遭遇した場合は、[Issue](https://github.com/WEIFENG2333/VideoCaptioner/issues)の提出とPull Requestによるプロジェクト改善へのご協力をお願いします。
-
-## 更新履歴
-
-
-2024.1.22
-
-### コア機能の強化
-- コードアーキテクチャの完全なリファクタリング、全体的なパフォーマンスの最適化
-- 字幕の最適化と翻訳機能モジュールを分離し、より柔軟な処理オプションを提供
-- バッチ処理機能を追加:バッチ字幕、バッチトランスクリプション、バッチ字幕ビデオ合成をサポート
-- UIインターフェースとインタラクションの詳細を包括的に最適化
-
-### AIモデルと翻訳のアップグレード
-- LLMサポートの拡大:SiliconCloud、DeepSeek、Ollama、Gemini、ChatGLMなどのモデルを追加
-- 複数の翻訳サービスを統合:DeepLx、Bing、Google、LLM
-- faster-whisper-large-v3-turboモデルのサポートを追加
-- 複数のVAD(音声活動検出)メソッドを追加
-- カスタム反映翻訳スイッチをサポート
-- 字幕セグメンテーションはセマンティック/文モードをサポート
-- 字幕セグメンテーション、最適化、翻訳のプロンプトを最適化
-- 字幕とトランスクリプションのキャッシュメカニズムを最適化
-- 中国語字幕の自動改行を改善
-- 垂直字幕スタイルを追加
-- 字幕タイムライン切り替えメカニズムを改善し、ちらつき問題を解消
-
-### バグ修正とその他の改善
-- Whisper APIが使用できない問題を修正
-- 複数の字幕ビデオ形式をサポート
-- 一部のケースでのトランスクリプションエラーの問題を修正
-- ビデオ作業ディレクトリ構造を最適化
-- ログ表示機能を追加
-- タイ語、ドイツ語などの言語の字幕最適化を追加
-- 多くのバグを修正...
-
-
-
-
-2024.12.07
-
-- Faster-whisper対応を追加、音声から字幕への変換品質向上
-- Vad音声区切り検出対応、幻聴現象を大幅に削減
-- 音声分離対応、動画のバックグラウンドノイズを分離
-- 動画合成の無効化に対応
-- 字幕最大長設定を追加
-- 字幕末尾の句読点削除設定を追加
-- 最適化と翻訳のプロンプトを改善
-- LLMの字幕分割エラーを改善
-- 音声変換フォーマットの不一致問題を修正
-
-
-
-
-2024.11.23
-
-- Whisper-v3モデル対応を追加、音声認識精度を大幅に向上
-- 字幕分割アルゴリズムを最適化、より自然な読書体験を提供
-- モデル利用可能性チェック時の安定性問題を修正
-
-
-
-2024.11.20
-
-- 字幕位置とスタイルのカスタマイズに対応
-- 字幕最適化と翻訳プロセスのリアルタイムログ表示を追加
-- API使用時の自動翻訳問題を修正
-- 動画作業ディレクトリ構造を最適化、ファイル管理効率を向上
-
+4. YouTubeリンクを処理する際、ビデオ字幕が自動的にダウンロードされ、トランスクリプションステップが省略され、操作時間が大幅に短縮されます。
-
-2024.11.17
+## 🤝 貢献ガイドライン
-- バイリンガル/モノリンガル字幕の柔軟なエクスポートに対応
-- 原稿マッチングプロンプト整列機能を追加
-- 字幕インポート時の安定性問題を修正
-- 非中国語パスでのモデルダウンロードの互換性問題を修正
-
+プロジェクトは継続的に改善中で、使用中にバグに遭遇した場合は、[Issue](https://github.com/WEIFENG2333/VideoCaptioner/issues)の提出とPull Requestによるプロジェクト改善へのご協力をお願いします。
-
-2024.11.13
+## 📝 更新履歴
-- Whisper API呼び出し対応を追加
-- cookie.txtのインポートで各種動画プラットフォームのリソースダウンロードに対応
-- 字幕ファイル名を動画と自動的に一致
-- ソフトウェアメインページにランタイムログのリアルタイム表示を追加
-- ソフトウェア内部機能を統一化し完備
-
+完全な更新履歴は[CHANGELOG.md](../CHANGELOG.md)をご覧ください。
## ⭐ Star History
@@ -342,9 +296,12 @@ VideoCaptioner/
## 💖 作者を支援する
-このプロジェクトがお役に立てましたら、Starを付けていただけると幸いです。それが私にとって最大の励みとサポートになります!
+このプロジェクトがお役に立てましたら、Starを付けていただけると幸いです!
+
+寄付サポート

-
\ No newline at end of file
+
+
diff --git a/legacy-docs/README_TW.md b/legacy-docs/README_TW.md
index de81a3b5..ab152901 100644
--- a/legacy-docs/README_TW.md
+++ b/legacy-docs/README_TW.md
@@ -1,26 +1,24 @@
-```markdown
卡卡字幕助手
VideoCaptioner
一款基於大語言模型(LLM)的視頻字幕處理助手,支持語音識別、字幕斷句、優化、翻譯全流程處理
- 簡體中文 / [正體中文](./docs/README_TW.md) / [English](./docs/README_EN.md) / [日本語](./docs/README_JA.md)
-
+ [简体中文](../README.md) / 正體中文 / [English](./README_EN.md) / [日本語](./README_JA.md)
+
+📚 **[線上文檔](https://weifeng2333.github.io/VideoCaptioner/)** | 🚀 **[快速開始](https://weifeng2333.github.io/VideoCaptioner/guide/getting-started)** | ⚙️ **[配置指南](https://weifeng2333.github.io/VideoCaptioner/config/llm)**
+
## 📖 項目介紹
-卡卡字幕助手(VideoCaptioner)操作簡單且無需高配置,支持網絡調用和本地離線(支持調用 GPU)兩種方式進行語音識別,利用大語言模型進行字幕智能斷句、校正、翻譯,全流程一鍵處理字幕視頻!為視頻配上效果驚艷的字幕。
-
-最新版本已經支持 VAD、人聲分離、字級時間戳、批量字幕等實用功能
+卡卡字幕助手(VideoCaptioner)操作簡單且無需高配置,支持 API 和本地離線兩種方式進行語音識別,利用大語言模型進行字幕智能斷句、校正、翻譯,字幕視頻全流程一鍵處理。為視頻配上效果驚艷的字幕。
-- 🎯 無需 GPU 即可使用強大的語音識別引擎,生成精準字幕
-- ✂️ 基於 LLM 的智能分割與斷句,字幕閱讀更自然流暢
-- 🔄 AI 字幕多線程優化與翻譯,調整字幕格式、表達更地道專業
-- 🎬 支持批量視頻字幕合成,提升處理效率
-- 📝 直觀的字幕編輯查看介面,支持即時預覽和快捷編輯
-- 🤖 消耗模型 Token 少,且內置基礎 LLM 模型,保證開箱即用
+- 支持詞級時間戳與 VAD 語音活動檢測,識別準確率高
+- 基於 LLM 的語義理解,自動將逐字字幕重組為自然流暢的句子段落
+- 結合上下文的 AI 翻譯,支持反思優化機制,譯文地道專業
+- 支持批量視頻字幕合成,提升處理效率
+- 直觀的字幕編輯查看介面,支持即時預覽和快捷編輯
## 📸 介面預覽
@@ -33,318 +31,290 @@
## 🧪 測試
-全流程處理一個 14 分鐘 1080P 的 [B站英文 TED 視頻](https://www.bilibili.com/video/BV1jT411X7Dz),調用本地 Whisper 模型進行語音識別,使用 `gpt-4o-mini` 模型優化和翻譯為中文,總共消耗時間約 **3 分鐘**。
+全流程處理一個 14 分鐘 1080P 的 [B站英文 TED 視頻](https://www.bilibili.com/video/BV1jT411X7Dz),調用本地 Whisper 模型進行語音識別,使用 `gpt-5-mini` 模型優化和翻譯為中文,總共消耗時間約 **4 分鐘**。
根據後台計算,模型優化和翻譯消耗費用不足 ¥0.01(以 OpenAI 官方價格計算)
-具體字幕和視頻合成效果的測試結果圖片,請參考 [TED 視頻測試](./docs/test.md)
+具體字幕和視頻合成效果的測試結果圖片,請參考 [TED 視頻測試](./test.md)
## 🚀 快速開始
### Windows 用戶
+#### 方式一:使用打包程式(推薦)
+
軟體較為輕量,打包大小不足 60M,已集成所有必要環境,下載後可直接運行。
-1. 從 [Release](https://github.com/WEIFENG2333/VideoCaptioner/releases) 頁面下載最新版本的可執行程式。或者:[藍奏盤下載](https://wwwm.lanzoue.com/iam1L2n8n3za)
+1. 從 [Release](https://github.com/WEIFENG2333/VideoCaptioner/releases) 頁面下載最新版本的可執行程式。或者:[藍奏盤下載](https://wwwm.lanzoue.com/ii14G2pdsbej)
2. 打開安裝包進行安裝
-3. (可選)LLM API 配置,選擇是否啟用字幕優化或者字幕翻譯
+3. LLM API 配置(用於字幕斷句、校正),可使用[本項目的中轉站](https://api.videocaptioner.cn)
-4. 拖拽視頻檔案到軟體窗口,即可全自動處理
+4. 翻譯配置,選擇是否啟用翻譯,翻譯服務(預設使用微軟翻譯,質量一般,推薦配置自己的 API KEY 使用大模型翻譯)
-提示:每個步驟均支持單獨處理,均支持檔案拖拽。
+5. 語音識別配置(預設使用B介面網路調用語音識別服務,中英以外的語言請使用本地轉錄)
-
-MacOS 用戶
-
-由於本人缺少 Mac,所以無法測試和打包,暫時無法提供 MacOS 的可執行程式。
+### macOS 用戶
-Mac 用戶請自行使用下載源碼並安裝 python 依賴運行。(本地 Whisper 功能暫不支持 MacOS)
+#### 一鍵安裝運行(推薦)
-1. 安裝 ffmpeg 和 Aria2 下載工具
```bash
-brew install ffmpeg
-brew install aria2
-brew install python@3.**
-```
+# 方式一:直接運行(自動安裝 uv、克隆項目、安裝相關依賴)
+curl -fsSL https://raw.githubusercontent.com/WEIFENG2333/VideoCaptioner/main/scripts/run.sh | bash
-2. 克隆項目
-```bash
+# 方式二:先克隆再運行
git clone https://github.com/WEIFENG2333/VideoCaptioner.git
cd VideoCaptioner
+./scripts/run.sh
```
-3. 安裝依賴
-```bash
-python3.** -m venv venv
-source venv/bin/activate
-pip install -r requirements.txt
-```
+腳本會自動:
+
+1. 安裝 [uv](https://docs.astral.sh/uv/) 套件管理器(如果未安裝)
+2. 克隆項目到 `~/VideoCaptioner`(如果不在項目目錄中運行)
+3. 安裝所有 Python 依賴
+4. 啟動應用
+
+
+手動安裝步驟
+
+#### 1. 安裝 uv 套件管理器
-4. 運行程式
```bash
-python main.py
+curl -LsSf https://astral.sh/uv/install.sh | sh
```
-
-
-Docker 部署(beta)
+#### 2. 安裝系統依賴(macOS)
-目前應用較為簡略,歡迎各位 PR 貢獻。
+```bash
+brew install ffmpeg
+```
-### 1. 克隆項目
+#### 3. 克隆並運行
```bash
git clone https://github.com/WEIFENG2333/VideoCaptioner.git
cd VideoCaptioner
+uv sync # 安裝依賴
+uv run python main.py # 運行
```
-### 2. 構建鏡像
+
+
+### 開發者指南
```bash
-docker build -t video-captioner .
-```
+# 安裝依賴(包括開發依賴)
+uv sync
-### 3. 運行容器
+# 運行應用
+uv run python main.py
-使用自定義 API 配置運行:
-```bash
-docker run -d \
- -p 8501:8501 \
- -v $(pwd)/temp:/app/temp \
- -e OPENAI_BASE_URL="你的API地址" \
- -e OPENAI_API_KEY="你的API密鑰" \
- --name video-captioner \
- video-captioner
+# 類型檢查
+uv run pyright
+
+# 代碼檢查
+uv run ruff check .
```
-### 4. 訪問應用
+## 基本配置
-打開瀏覽器訪問:`http://localhost:8501`
+### 1. LLM API 配置說明
-### 注意事項
+LLM 大模型是用來字幕斷句、字幕優化、以及字幕翻譯(如果選擇了LLM 大模型翻譯)。
-- 容器內已預裝 ffmpeg 等必要依賴
-- 如需使用其他模型,請透過環境變數配置
+| 配置項 | 說明 |
+| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
+| SiliconCloud | [SiliconCloud 官網](https://cloud.siliconflow.cn/i/onCHcaDx)配置方法請參考[配置文檔](https://weifeng2333.github.io/VideoCaptioner/config/llm)
該並發較低,建議把線程設置為5以下。 |
+| DeepSeek | [DeepSeek 官網](https://platform.deepseek.com),建議使用 `deepseek-v3` 模型。 |
+| OpenAI兼容介面 | 如果有其他服務商的API,可直接在軟體中填寫。base_url 和api_key [VideoCaptioner API](https://api.videocaptioner.cn) |
-
+注:如果用的 API 服務商不支持高並發,請在軟體設置中將「線程數」調低,避免請求錯誤。
-## ✨ 主要功能
+---
-軟體充分利用大語言模型(LLM)在理解上下文方面的優勢,對語音識別生成的字幕進行進一步處理。有效修正錯別字、統一專業術語,讓字幕內容更加準確連貫,為使用者帶來出色的觀賞體驗!
+如果希望高並發,或者希望在軟體內使用 OpenAI 或者 Claude 等優質大模型進行字幕校正和翻譯。
-#### 1. 多平台視頻下載與處理
-- 支持國內外主流視頻平台(B站、Youtube 等)
-- 自動提取視頻原有字幕進行處理
+可使用本項目的✨LLM API中轉站✨: [https://api.videocaptioner.cn](https://api.videocaptioner.cn)
-#### 2. 專業的語音識別引擎
-- 提供多種介面線上識別,效果媲美剪映(免費、高速)
-- 支持本地 Whisper 模型(保護隱私、可離線)
+其支持高並發,性價比極高,且有國內外大量模型可挑選。
-#### 3. 字幕智能糾錯
-- 自動優化專業術語、程式碼片段和數學公式格式
-- 利用上下文進行斷句優化,提升閱讀體驗
-- 支持文稿提示,使用原有文稿或者相關提示優化字幕斷句
+註冊獲取key之後,設置中按照下面配置:
-#### 4. 高質量字幕翻譯
-- 結合上下文的智能翻譯,確保譯文兼顧全文
-- 透過 Prompt 指導大模型反思翻譯,提升翻譯質量
-- 使用序列模糊匹配算法,保證時間軸完全一致
+BaseURL: `https://api.videocaptioner.cn/v1`
-#### 5. 字幕樣式調整
-- 豐富的字幕樣式模板(科普風、新聞風、番劇風等等)
-- 多種格式字幕視頻(SRT、ASS、VTT、TXT)
+API-key: `個人中心-API 令牌頁面自行獲取。`
+
+💡 模型選擇建議 (本人在各質量層級中精選出的高性價比模型):
+
+- 高質量之選: `gemini-3-pro`、`claude-sonnet-4-5-20250929` (耗費比例:3)
+
+- 較高質量之選: `gpt-5-2025-08-07`、 `claude-haiku-4-5-20251001` (耗費比例:1.2)
+
+- 中質量之選: `gpt-5-mini`、`gemini-3-flash` (耗費比例:0.3)
+
+本站支持超高並發,軟體中線程數直接拉滿即可~ 處理速度非常快~
+
+更詳細的API配置教程:[中轉站配置](https://weifeng2333.github.io/VideoCaptioner/config/llm)
+
+---
-## ⚙️ 基本配置
+## 2. 翻譯配置
-### 1. LLM API 配置說明 (可選)
+| 配置項 | 說明 |
+| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| LLM 大模型翻譯 | 🌟 翻譯質量最好的選擇。使用 AI 大模型進行翻譯,能更好理解上下文,翻譯更自然。需要在設置中配置 LLM API(比如 OpenAI、DeepSeek 等) |
+| 微軟翻譯 | 使用微軟的翻譯服務,速度非常快 |
+| 谷歌翻譯 | 谷歌的翻譯服務,速度快,但需要能訪問谷歌的網路環境 |
-| 配置項 | 說明 |
-|----------|------|
-| 內置模型 | 軟體內置基礎大語言模型(`gpt-4o-mini`),無需配置即可使用(公益服務不穩定) |
-| API 支持 | 支持標準 OpenAI API 格式。兼容 [SiliconCloud](https://cloud.siliconflow.cn/i/HF95kaoz)、[DeepSeek](https://platform.deepseek.com/) 、 [Ollama](https://ollama.com/blog/openai-compatibility) 等。
配置方法請參考[配置文檔](./docs/llm_config.md) |
+推薦使用 `LLM 大模型翻譯` ,翻譯質量最好。
-推薦模型:追求更高質量可選用 `Claude-3.5-sonnet` 或 `gpt-4o`
+### 3. 語音識別介面說明
-### 2. 本地 Whisper 語音識別配置(需軟體內下載)
+| 介面名稱 | 支持語言 | 運行方式 | 說明 |
+| ---------------- | -------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
+| B介面 | 僅支持中文、英文 | 線上 | 免費、速度較快 |
+| J介面 | 僅支持中文、英文 | 線上 | 免費、速度較快 |
+| WhisperCpp | 中文、日語、韓語、英文等 99 種語言,外語效果較好 | 本地 | (實際使用不穩定)需要下載轉錄模型
中文建議medium以上模型
英文等使用較小模型即可達到不錯效果。 |
+| fasterWhisper 👍 | 中文、英文等多99種語言,外語效果優秀,時間軸更準確 | 本地 | (🌟推薦🌟)需要下載程式和轉錄模型
支持CUDA,速度更快,轉錄準確。
超級準確的時間戳字幕。
僅支持 Windows |
-Whisper 版本有 WhisperCpp 和 fasterWhisper(推薦)兩種,後者效果更好,都需要自行在軟體內下載模型。
+### 4. 本地 Whisper 語音識別模型
-| 模型 | 磁碟空間 | 記憶體佔用 | 說明 |
-|--------------|----------|----------|--------------------------------------|
-| Tiny | 75 MiB | ~273 MB | 轉錄效果一般,僅用於測試 |
-| Small | 466 MiB | ~852 MB | 英文識別效果已經不錯 |
-| Medium | 1.5 GiB | ~2.1 GB | 中文識別建議至少使用此版本 |
-| Large-v1/v2 👍 | 2.9 GiB | ~3.9 GB | 效果好,配置允許情況下推薦使用 |
-| Large-v3 | 2.9 GiB | ~3.9 GB | 社群回饋可能會出現幻覺/字幕重複問題 |
+Whisper 版本有 WhisperCpp 和 fasterWhisper(推薦) 兩種,後者效果更好,都需要自行在軟體內下載模型。
-推薦模型:Large-v1 穩定且質量較好。
+| 模型 | 磁碟空間 | 記憶體佔用 | 說明 |
+| ----------- | -------- | -------- | ----------------------------------- |
+| Tiny | 75 MiB | ~273 MB | 轉錄很一般,僅用於測試 |
+| Small | 466 MiB | ~852 MB | 英文識別效果已經不錯 |
+| Medium | 1.5 GiB | ~2.1 GB | 中文識別建議至少使用此版本 |
+| Large-v2 👍 | 2.9 GiB | ~3.9 GB | 效果好,配置允許情況推薦使用 |
+| Large-v3 | 2.9 GiB | ~3.9 GB | 社區反饋可能會出現幻覺/字幕重複問題 |
-註:以上模型國內網路可直接在軟體內下載;支持 GPU 也支持核顯調用。
+推薦模型: `Large-v2` 穩定且質量較好。
-### 3. 文稿匹配
-- 在「字幕優化與翻譯」頁面,包含「文稿匹配」選項,支持以下 **一種或者多種** 內容,輔助校正字幕和翻譯:
+### 5. 文稿匹配
-| 類型 | 說明 | 填寫示例 |
-|----------|----------------------------------------|--------------------------------------------------------------------------------------------|
-| 術語表 | 專業術語、人名、特定詞語的修正對照表 | 機器學習->Machine Learning
馬斯克->Elon Musk
打call -> 應援
圖靈斑圖
公車悖論 |
-| 原字幕文稿 | 視頻的原有文稿或相關內容 | 完整的演講稿、課程講義等 |
-| 修正要求 | 內容相關的具體修正要求 | 統一人稱代詞、規範專業術語等
填寫 **內容相關** 的要求即可,[示例參考](https://github.com/WEIFENG2333/VideoCaptioner/issues/59#issuecomment-2495849752) |
+- 在「字幕優化與翻譯」頁面,包含「文稿匹配」選項,支持以下**一種或者多種**內容,輔助校正字幕和翻譯:
-- 如果需要文稿進行字幕優化輔助,全流程處理時,先填寫文稿資訊,再開始任務處理
-- 注意:使用上下文參數量不高的小型 LLM 模型時,建議控制文稿內容在 1 千字內;如果使用上下文較大的模型,則可以適當增加文稿內容。
+| 類型 | 說明 | 填寫示例 |
+| ---------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 術語表 | 專業術語、人名、特定詞語的修正對照表 | 機器學習->Machine Learning
馬斯克->Elon Musk
打call -> 應援
圖靈斑圖
公車悖論 |
+| 原字幕文稿 | 視頻的原有文稿或相關內容 | 完整的演講稿、課程講義等 |
+| 修正要求 | 內容相關的具體修正要求 | 統一人稱代詞、規範專業術語等
填寫**內容相關**的要求即可,[示例參考](https://github.com/WEIFENG2333/VideoCaptioner/issues/59#issuecomment-2495849752) |
-### 4. 語音識別介面說明
+- 如果需要文稿進行字幕優化輔助,全流程處理時,先填寫文稿資訊,再進行開始任務處理
+- 注意: 使用上下文參數量不高的小型LLM模型時,建議控制文稿內容在1千字內,如果使用上下文較大的模型,則可以適當增加文稿內容。
-| 接口名稱 | 支持語言 | 運行方式 | 說明 |
-|------------------|----------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------|
-| B 接口 | 僅支持中文、英文 | 線上 | 免費、速度較快 |
-| J 接口 | 僅支持中文、英文 | 線上 | 免費、速度較快 |
-| WhisperCpp | 中文、日語、韓語、英文等 99 種語言,外語效果較好 | 本地 | (實際使用不穩定)需要下載轉錄模型
中文建議 medium 以上模型
英文等使用較小模型即可達到不錯效果。 |
-| fasterWhisper 👍 | 中文、英文等多 99 種語言,外語效果優秀,時間軸更準確 | 本地 | (🌟極力推薦🌟)需要下載程式和轉錄模型
支持 CUDA,速度更快,轉錄準確。
超級準確的時間戳字幕。
建議優先使用。 |
+無特殊需求,可不填寫。
-### 5. Cookie 配置說明
+### 6. Cookie 配置說明
-如果使用 URL 下載功能時,若遇到以下情況:
-1. 下載視頻網站需要登入資訊才可下載;
+如果使用URL下載功能時,如果遇到以下情況:
+
+1. 下載視頻網站需要登入資訊才可以下載;
2. 只能下載較低解析度的視頻;
3. 網路條件較差時需要驗證;
-- 請參考 [Cookie 配置說明](./docs/get_cookies.md) 獲取 Cookie 資訊,並將 cookies.txt 檔案放置到軟體安裝目錄的 `AppData` 目錄下,即可正常下載高品質視頻。
+- 請參考 [Cookie 配置說明](https://weifeng2333.github.io/VideoCaptioner/guide/cookies-config) 獲取Cookie資訊,並將cookies.txt檔案放置到軟體安裝目錄的 `AppData` 目錄下,即可正常下載高質量視頻。
-## 💡 軟體流程介紹
+## 軟體流程介紹
-程式簡單的處理流程如下:
+程式簡單的處理流程如下:
```
-語音識別 -> 字幕斷句(可選) -> 字幕優化翻譯(可選) -> 字幕視頻合成
+語音識別轉錄 -> 字幕斷句(可選) -> 字幕優化翻譯(可選) -> 字幕視頻合成
```
-安裝軟體的主要目錄結構說明如下:
-```
-VideoCaptioner/
-├── runtime/ # 運行環境目錄(不用更改)
-├── resources/ # 軟體資源檔案目錄(二進位程式、圖示等,以及下載的 faster-whisper 程式)
-├── work-dir/ # 工作目錄,處理完成的視頻和字幕檔案保存在這裡
-├── AppData/ # 應用資料目錄
-│ ├── cache/ # 快取目錄,快取轉錄、大模型請求的資料
-│ ├── models/ # 存放 Whisper 模型檔案
-│ ├── logs/ # 日誌目錄,記錄軟體運行狀態
-│ ├── settings.json # 存儲使用者設置
-│ └── cookies.txt # 視頻平台的 cookie 資訊(下載高清視頻時需要)
-└── VideoCaptioner.exe # 主程式執行檔
-```
+## 軟體主要功能
-## 📝 說明
+軟體利用大語言模型(LLM)在理解上下文方面的優勢,對語音識別生成的字幕進一步處理。有效修正錯別字、統一專業術語,讓字幕內容更加準確連貫,為用戶帶來出色的觀看體驗!
-1. 字幕斷句的質量對觀賞體驗至關重要。為此我開發了 [SubtitleSpliter](https://github.com/WEIFENG2333/SubtitleSpliter),它能將逐字字幕智能重組為符合自然語言習慣的段落,並與視頻畫面完美同步。
+#### 1. 多平台視頻下載與處理
-2. 在處理過程中,僅向大語言模型發送文本內容,不包含時間軸資訊,這大大降低了處理開銷。
+- 支持國內外主流視頻平台(B站、Youtube、小紅書、TikTok、X、西瓜視頻、抖音等)
+- 自動提取視頻原有字幕處理
-3. 在翻譯環節,我們採用了吳恩達提出的「翻譯-反思-翻譯」方法論。這種迭代優化的方式不僅確保了翻譯的準確性。
+#### 2. 專業的語音識別引擎
-## 🤝 貢獻指南
+- 提供多種介面線上識別,效果媲美剪映(免費、高速)
+- 支持本地Whisper模型(保護隱私、可離線)
-作者是一名大三學生,個人能力和專案都還有許多不足,專案也在不斷完善中,如果在使用過程中遇到 Bug,歡迎提交 [Issue](https://github.com/WEIFENG2333/VideoCaptioner/issues) 與 Pull Request 以幫助改進專案。
+#### 3. 字幕智能糾錯
-## 更新日誌
+- 自動優化專業術語、代碼片段和數學公式格式
+- 上下文進行斷句優化,提升閱讀體驗
+- 支持文稿提示,使用原有文稿或者相關提示優化字幕斷句
-
-2024.1.22
-
-### 核心功能增強
-- 完整重構程式碼架構,優化整體效能
-- 字幕優化與翻譯功能模組分離,提供更靈活的處理選項
-- 新增批量處理功能:支持批量字幕、批量轉錄、批量字幕視頻合成
-- 全面優化 UI 介面與交互細節
-
-### AI 模型與翻譯升級
-- 擴展 LLM 支持:新增 SiliconCloud、DeepSeek、Ollama、Gemini、ChatGLM 等模型
-- 集成多種翻譯服務:DeepLx、Bing、Google、LLM
-- 新增 faster-whisper-large-v3-turbo 模型支持
-- 新增多種 VAD(語音活動檢測)方法
-- 支持自定義反思翻譯開關
-- 字幕斷句支持語義/句子兩種模式
-- 字幕斷句、優化、翻譯提示詞的優化
-- 字幕、轉錄快取機制的優化
-- 優化中文字幕自動換行功能
-- 新增豎屏字幕樣式
-- 改進字幕時間軸切換機制,消除閃爍問題
-
-### Bug 修復與其他改進
-- 修復 Whisper API 無法使用問題
-- 新增多種字幕視頻格式支持
-- 修復部分情況轉錄錯誤的問題
-- 優化視頻工作目錄結構
-- 新增日誌查看功能
-- 新增泰語、德語等語言的字幕優化
-- 修復諸多 Bug...
+#### 4. 高質量字幕翻譯
-
+- 結合上下文的智能翻譯,確保譯文兼顧全文
+- 透過Prompt指導大模型反思翻譯,提升翻譯質量
+- 使用序列模糊匹配算法、保證時間軸完全一致
-
-2024.12.07
-
-- 新增 Faster-whisper 支持,音頻轉字幕質量更優
-- 支持 VAD 語音斷點檢測,大大減少幻覺現象
-- 支持人聲分離,分離視頻背景噪音
-- 支持關閉視頻合成
-- 新增字幕最大長度設定
-- 新增字幕末尾標點去除設定
-- 優化和翻譯的提示詞優化
-- 優化 LLM 字幕斷句錯誤的情況
-- 修復音頻轉換格式不一致問題
+#### 5. 字幕樣式調整
-
+- 豐富的字幕樣式模板(科普風、新聞風、番劇風等等)
+- 多種格式字幕視頻(SRT、ASS、VTT、TXT)
-
-2024.11.23
+項目主要目錄結構說明如下:
-- 新增 Whisper-v3 模型支持,大幅提升語音識別準確率
-- 優化字幕斷句算法,提供更自然的閱讀體驗
-- 修復檢測模型可用性時的穩定性問題
-
+```
+VideoCaptioner/
+├── app/ # 應用源代碼目錄
+│ ├── common/ # 公共模組(配置、信號匯流排)
+│ ├── components/ # UI 元件
+│ ├── core/ # 核心業務邏輯(ASR、翻譯、優化等)
+│ ├── thread/ # 異步線程
+│ └── view/ # 介面視圖
+├── resource/ # 資源檔案目錄
+│ ├── assets/ # 圖示、Logo 等
+│ ├── bin/ # 二進制程式(FFmpeg、Whisper 等)
+│ ├── fonts/ # 字體檔案
+│ ├── subtitle_style/ # 字幕樣式模板
+│ └── translations/ # 多語言翻譯檔案
+├── work-dir/ # 工作目錄(處理完成的視頻和字幕)
+├── AppData/ # 應用資料目錄
+│ ├── cache/ # 快取目錄(轉錄、LLM 請求)
+│ ├── models/ # Whisper 模型檔案
+│ ├── logs/ # 日誌檔案
+│ └── settings.json # 用戶設置
+├── scripts/ # 安裝和運行腳本
+├── main.py # 程式入口
+└── pyproject.toml # 項目配置和依賴
+```
-
-2024.11.20
+## 📝 說明
-- 支持自定義調節字幕位置和樣式
-- 新增字幕優化和翻譯過程的即時日誌查看
-- 修復使用 API 時的自動翻譯問題
-- 優化視頻工作目錄結構,提升檔案管理效率
-
+1. 字幕斷句的質量對觀看體驗至關重要。軟體能將逐字字幕智能重組為符合自然語言習慣的段落,並與視頻畫面完美同步。
-
-2024.11.17
+2. 在處理過程中,僅向大語言模型發送文本內容,不包含時間軸資訊,這大大降低了處理開銷。
-- 支持雙語/單語字幕靈活導出
-- 新增文稿匹配提示對齊功能
-- 修復字幕導入時的穩定性問題
-- 修復非中文路徑下載模型的相容性問題
-
+3. 在翻譯環節,我們採用吳恩達提出的「翻譯-反思-翻譯」方法論。這種迭代優化的方式確保了翻譯的準確性。
-
-2024.11.13
+4. 填入 YouTube 連結時進行處理時,會自動下載視頻的字幕,從而省去轉錄步驟,極大地節省操作時間。
-- 新增 Whisper API 調用支持
-- 支持導入 cookie.txt 下載各大視頻平台資源
-- 字幕檔名自動與視頻保持一致
-- 軟體首頁新增運行日誌即時查看
-- 統一和完善軟體內部功能
-
+## 🤝 貢獻指南
-## ⭐ 星標歷史
+項目在不斷完善中,如果在使用過程遇到的Bug,歡迎提交 [Issue](https://github.com/WEIFENG2333/VideoCaptioner/issues) 和 Pull Request 幫助改進項目。
+
+## 📝 更新日誌
+
+查看完整的更新歷史,請訪問 [CHANGELOG.md](../CHANGELOG.md)
+
+## ⭐ Star History
[](https://star-history.com/#WEIFENG2333/VideoCaptioner&Date)
## 💖 支持作者
-如果覺得專案對你有幫助,可以給專案點個 Star,這將是對我最大的鼓勵和支持!
+如果覺得項目對你有幫助,可以給項目點個Star!
+
+捐助支持
-```
\ No newline at end of file
+
diff --git a/scripts/run.bat b/scripts/run.bat
index d7459797..4b0df662 100644
--- a/scripts/run.bat
+++ b/scripts/run.bat
@@ -127,15 +127,10 @@ exit /b 0
:check_system_deps
where ffmpeg >nul 2>&1
if %errorlevel% neq 0 (
- echo [WARN] ffmpeg not found. Some features may not work.
+ echo [WARN] FFmpeg not found ^(required for video synthesis^)
echo Install with: winget install ffmpeg
echo Or download from: https://ffmpeg.org/download.html
)
-
-where aria2c >nul 2>&1
-if %errorlevel% neq 0 (
- echo [WARN] aria2 not found ^(optional, for faster model downloads^)
-)
exit /b 0
:run_app
diff --git a/scripts/run.sh b/scripts/run.sh
index 905f1129..3ef0f316 100644
--- a/scripts/run.sh
+++ b/scripts/run.sh
@@ -106,29 +106,18 @@ install_dependencies() {
# Check system dependencies
check_system_deps() {
- local missing_deps=()
-
- # Check ffmpeg
+ # Check ffmpeg (required)
if ! command -v ffmpeg &> /dev/null; then
- missing_deps+=("ffmpeg")
- fi
-
- # Check aria2 (optional, for faster downloads)
- if ! command -v aria2c &> /dev/null; then
- print_warning "aria2 not found (optional, for faster model downloads)"
- fi
-
- if [ ${#missing_deps[@]} -gt 0 ]; then
- print_warning "Missing system dependencies: ${missing_deps[*]}"
+ print_warning "FFmpeg not found (required for video synthesis)"
if [[ "$OSTYPE" == "darwin"* ]]; then
- echo " Install with: brew install ${missing_deps[*]}"
+ echo " Install with: brew install ffmpeg"
elif command -v apt &> /dev/null; then
- echo " Install with: sudo apt install ${missing_deps[*]}"
+ echo " Install with: sudo apt install ffmpeg"
elif command -v dnf &> /dev/null; then
- echo " Install with: sudo dnf install ${missing_deps[*]}"
+ echo " Install with: sudo dnf install ffmpeg"
elif command -v pacman &> /dev/null; then
- echo " Install with: sudo pacman -S ${missing_deps[*]}"
+ echo " Install with: sudo pacman -S ffmpeg"
fi
fi
}