#5806 System Error (None): NoneTraceback (most recent call last): File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-pack

2a14:7dc0* Posted at: 1 day ago

System Error (None): None
Traceback (most recent call last):
File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/soundfile.py", line 267, in

_snd = _ffi.dlopen('sndfile')

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen

lib, function_cache = _make_ffi_library(self, name, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library

backendlib = _load_backend_lib(backend, libname, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 829, in _load_backend_lib

raise OSError(msg)

OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/only_one.py", line 46, in run

trk.recogn()

File "/Users/zt/pyvideotrans/videotrans/task/_stage_recogn.py", line 62, in recogn

raw_subtitles = run_recogn(

File "/Users/zt/pyvideotrans/videotrans/recognition/__init__.py", line 201, in run

_cls: Union[Type[BaseRecogn], None] = get_class(recogn_type, "recognition", _ID_NAME_DICT)

File "/Users/zt/pyvideotrans/videotrans/__init__.py", line 28, in get_class

module = importlib.import_module(f'videotrans.{provider_type}{_module_map.imp}', __name__)

File "/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/lib/python3.10/importlib/__init__.py", line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/zt/pyvideotrans/videotrans/recognition/_whisper.py", line 13, in

from videotrans.process import openai_whisper, faster_whisper

File "/Users/zt/pyvideotrans/videotrans/process/__init__.py", line 2, in

from .tts_fun import qwen3tts_fun

File "/Users/zt/pyvideotrans/videotrans/process/tts_fun.py", line 9, in

import soundfile as sf

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/soundfile.py", line 276, in

_snd = _ffi.dlopen(_os.path.join(

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen

lib, function_cache = _make_ffi_library(self, name, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library

backendlib = _load_backend_lib(backend, libname, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 829, in _load_backend_lib

raise OSError(msg)

OSError: cannot load library '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file). Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib'

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: /Users/zt/Downloads/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p.mp4,
输出结果保存到文件夹: /Users/zt/Downloads/_video_out/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p-mp4,
临时文件夹: /Users/zt/pyvideotrans/tmp/5465/c524117875
已选 清理已存在
未选 启用CUDA加速
未选 降噪
ASR Channel:faster-whisper(LocalBuilt-in), model_name: large-v3-turbo, 发音语言: English, 断句方式:默认断句
Trans Channel:Google (Free),原始语言:English,目标语言:Simplified Chinese, 已选 Send SRT
Dubb Channel:Qwen3-TTS(LocalBuilt-in), 角色:clone, 配音语言:Simplified Chinese, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: Embed Hard Subs
代理地址:

19 Replies

这是由于 macOS 系统缺少音频处理库 libsndfilesoundfile Python 模块依赖于该动态库来读写音频文件,在当前环境中未能被加载。

解决方案

  1. 使用 Homebrew 安装 libsndfile

    brew install libsndfile
  2. 安装完成后,重新同步 Python 依赖以确保 soundfile 可以正确链接:

    uv sync
  3. 重启 pyVideoTrans 后重新尝试执行任务。

如果问题依然出现,请确认 brew install libsndfile 执行无报错,并检查 /opt/homebrew/lib/ 目录下是否存在 libsndfile.dylib 文件(Apple Silicon Mac)或 /usr/local/lib/(Intel Mac)。

请查阅相关文档:

系统错误 (None):None
Traceback (most recent call last):
File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/soundfile.py", line 267, in

_snd = _ffi.dlopen('sndfile')

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen

lib, function_cache = _make_ffi_library(self, name, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library

backendlib = _load_backend_lib(backend, libname, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 829, in _load_backend_lib

raise OSError(msg)

OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/only_one.py", line 46, in run

trk.recogn()

File "/Users/zt/pyvideotrans/videotrans/task/_stage_recogn.py", line 62, in recogn

raw_subtitles = run_recogn(

File "/Users/zt/pyvideotrans/videotrans/recognition/__init__.py", line 201, in run

_cls: Union[Type[BaseRecogn], None] = get_class(recogn_type, "recognition", _ID_NAME_DICT)

File "/Users/zt/pyvideotrans/videotrans/__init__.py", line 28, in get_class

module = importlib.import_module(f'videotrans.{provider_type}{_module_map.imp}', __name__)

File "/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/lib/python3.10/importlib/__init__.py", line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/zt/pyvideotrans/videotrans/recognition/_whisper.py", line 13, in

from videotrans.process import openai_whisper, faster_whisper

File "/Users/zt/pyvideotrans/videotrans/process/__init__.py", line 2, in

from .tts_fun import qwen3tts_fun

File "/Users/zt/pyvideotrans/videotrans/process/tts_fun.py", line 9, in

import soundfile as sf

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/soundfile.py", line 276, in

_snd = _ffi.dlopen(_os.path.join(

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen

lib, function_cache = _make_ffi_library(self, name, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library

backendlib = _load_backend_lib(backend, libname, flags)

File "/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 829, in _load_backend_lib

raise OSError(msg)

OSError: cannot load library '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file). Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/zt/pyvideotrans/.venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib'

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: /Users/zt/Downloads/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p.mp4,
输出结果保存到文件夹: /Users/zt/Downloads/_video_out/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p-mp4,
临时文件夹: /Users/zt/pyvideotrans/tmp/5777/c524117875
已选 清理已存在
未选 启用CUDA加速
未选 降噪
语音识别:faster-whisper(本地内置), model_name: large-v3-turbo, 发音语言: 英语, 断句方式:默认断句
翻译渠道:兼容AI/本地模型,原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Qwen3-TTS(本地内置), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
代理地址:

该错误仍是由于 macOS 系统缺少 libsndfile 音频处理库导致。请执行以下步骤确保正确安装:

  1. 使用 Homebrew 安装 libsndfile:

    brew install libsndfile

    如果提示 brew: command not found,请先安装 Homebrew(https://brew.sh)。

  2. 安装后重新运行 uv sync 以确保 Python 的 soundfile 包能正确链接到该库:

    uv sync
  3. 验证安装是否成功:

    brew list libsndfile

    应显示安装路径,通常为 /opt/homebrew/Cellar/libsndfile/...(Apple Silicon Mac)或 /usr/local/Cellar/libsndfile/...(Intel Mac)。

  4. 如果仍报错,请检查你的 Python 虚拟环境是否使用了正确的 Homebrew 路径。可尝试手动将 Homebrew 的 lib 目录添加到动态库搜索路径:

    export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH

    然后重新运行软件。

安装完成后重启 pyVideoTrans,问题应可解决。

还是报错

该错误的原因是 macOS 上 soundfile Python 模块未能找到已安装的 libsndfile 动态库,需要显式指定库搜索路径或重新编译 soundfile

请按以下步骤操作:

  1. 确认 libsndfile 安装位置
    在终端执行:

    brew --prefix libsndfile

    输出类似 /opt/homebrew(Apple Silicon)或 /usr/local(Intel)。记录该路径,假设为 $(brew --prefix)

  2. 重新安装 soundfile 包
    在项目目录下执行,强制重新编译 soundfile 以链接到 Homebrew 的 libsndfile:

    uv remove soundfile
    uv add soundfile
  3. 若仍报错,手动设置动态库路径
    每次启动软件前,在终端先运行以下命令再启动 sp.py:

    export DYLD_LIBRARY_PATH=$(brew --prefix libsndfile)/lib:$DYLD_LIBRARY_PATH
    uv run sp.py

    如果希望永久生效,可将该 export 命令添加到 shell 配置文件(如 ~/.zshrc)中。

  4. 验证库是否可访问
    在 Python 中测试:

    uv run python -c "import soundfile; print(soundfile.__version__)"

    如果无报错,说明问题已解决。

如果上述步骤仍无效,请提供以下信息以便进一步排查:

  • brew list libsndfile 的输出
  • 执行 uv run python -c "import ctypes; print(ctypes.util.find_library('sndfile'))" 的结果(应返回一个路径或 None)

请查阅相关文档:

(base) zt@ztdeMac-mini ~ % brew list libsndfile
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-cmp
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-concat
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-convert
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-deinterleave
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-info
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-interleave
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-metadata-get
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-metadata-set
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-play
/opt/homebrew/Cellar/libsndfile/1.2.2_1/bin/sndfile-salvage
/opt/homebrew/Cellar/libsndfile/1.2.2_1/include/ (2 files)
/opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib
/opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/cmake/ (4 files)
/opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/pkgconfig/sndfile.pc
/opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/ (3 other files)
/opt/homebrew/Cellar/libsndfile/1.2.2_1/sbom.spdx.json
/opt/homebrew/Cellar/libsndfile/1.2.2_1/share/doc/ (16 files)
/opt/homebrew/Cellar/libsndfile/1.2.2_1/share/man/ (10 files)
(base) zt@ztdeMac-mini ~ % export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
(base) zt@ztdeMac-mini ~ %

从输出看,libsndfile 已正确安装(位于 /opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib)。问题出在 Python 的 soundfile 模块未能找到该库。请按以下顺序操作,每一步完成后都尝试重新执行 uv run sp.py,确认问题是否解决


1. 创建正确的符号链接(最常用解决方案)

soundfile 默认会查找 libsndfile.dylib(不含版本号),但 Homebrew 安装的是带版本号的 libsndfile.1.0.37.dylib。运行以下命令创建必要的符号链接:

ln -sf /opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib /opt/homebrew/lib/libsndfile.dylib
ln -sf /opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.dylib /opt/homebrew/lib/libsndfile.1.dylib

然后执行:uv run python -c "import soundfile; print(soundfile.__version__)" 测试。


2. 重新安装 soundfile(确保编译时链接 Homebrew 库)

在项目目录下执行:

export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
uv remove soundfile
uv add soundfile --no-cache

3. 直接在终端启动软件前设置环境变量

每次启动软件前,必须在同一个终端会话中执行:

export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
uv run sp.py

不要打开新的终端窗口,否则环境变量失效。你可以将 export 命令添加到 ~/.zshrc 中永久生效:

echo 'export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH' >> ~/.zshrc
source ~/.zshrc

4. 检查是否在正确的 Python 虚拟环境内

注意你当前处于 (base) conda 环境,但 pyVideoTrans 使用 uv 管理的虚拟环境(位于 .venv)。请退出 base 环境conda deactivate),确保在项目目录下操作,且 uv run 使用的是项目的 .venv


5. 如果上述均无效,尝试使用 Homebrew 重新安装 libsndfile 并强制链接

brew reinstall libsndfile
brew link --overwrite libsndfile

6. 最终验证

执行以下命令,返回应该是 /opt/homebrew/lib/libsndfile.dylib 之类的路径:

uv run python -c "import ctypes; print(ctypes.util.find_library('sndfile'))"

如果仍返回 None,则说明 Python 的 ctypes 找不到该库,请确认 /opt/homebrew/lib/ 下是否有 libsndfile.dylib 文件(步骤1已创建符号链接)。检查后重新测试。

上述方法均无效

问题根源是 soundfile 模块在 macOS 上无法自动定位 Homebrew 安装的 libsndfile,且所有环境变量和符号链接方案均未生效。请按以下终极方案操作,它将创建一个全新的、干净的虚拟环境,从根本上避免库路径冲突。

最终修复步骤

  1. 完全退出 conda 环境
    在终端执行:

    conda deactivate

    确保提示符前不再显示 (base)

  2. 删除当前项目的虚拟环境
    进入 pyVideoTrans 项目目录:

    cd /Users/zt/pyvideotrans
    rm -rf .venv
  3. 在家目录下安装 libsndfile(避免引用路径问题)
    这是一个强力但有效的方法:将 Homebrew 安装的 libsndfile 库文件软链接到 Home 目录下的某处:

    mkdir -p ~/lib
    ln -sf /opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib ~/lib/libsndfile.dylib
    ln -sf /opt/homebrew/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.dylib ~/lib/libsndfile.1.dylib
  4. 重新创建虚拟环境并安装依赖

    uv sync
  5. 测试 soundfile 是否可以加载

    uv run python -c "import soundfile; print(soundfile.__version__)"

    如果无报错,说明修复成功。

  6. 如果仍然失败,手动安装 soundfile 并指定 Homebrew 库路径

    uv pip uninstall soundfile
    DYLD_LIBRARY_PATH=/opt/homebrew/lib uv pip install soundfile --no-binary :all:

    (这将从源码编译 soundfile,使其直接链接到 Homebrew 的 libsndfile)

  7. 启动软件测试

    uv run sp.py

如果以上方案全部失败

可能是 macOS 安全策略(SIP)或 DYLD_LIBRARY_PATH 被系统屏蔽。请尝试以下备选方案:

  • 使用 conda 环境代替 uv 虚拟环境(conda 会自动处理动态库):

    conda create -n pyvideo python=3.10
    conda activate pyvideo
    conda install -c conda-forge libsndfile ffmpeg
    cd /Users/zt/pyvideotrans
    pip install -r requirements.txt
    python sp.py

    注意:此方案会绕过 uv,但能彻底解决 macOS 动态库加载问题。

完成后请反馈是否成功,或提供以下信息以便进一步分析:

  • 执行 uv run python -c "import ctypes; print(ctypes.util.find_library('sndfile'))" 的输出
  • 步骤5的完整报错信息

最后一步字幕配音嵌入时出错: Filter not found
Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 423, in _subprocess

subprocess.run(

File "/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/lib/python3.10/subprocess.py", line 526, in run

raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command '['ffmpeg', '-nostdin', '-y', '-progress', 'compose1783953753.119594.txt', '-i', 'novoice.mp4', '-i', 'will_embed.m4a', '-filter_complex', "[0:v]subtitles=filename='end.ass'[v_out]", '-map', '[v_out]', '-map', '1:a', '-c:v', 'h264_videotoolbox', '-c:a', 'copy', '-q:v', '67', '-movflags', '+faststart', '-shortest', 'laste_target.mp4']' returned non-zero exit status 8.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 273, in _join_video_audio_srt

self._subp

......
ress', 'compose1783953753.119594.txt', '-i', 'novoice.mp4', '-i', 'will_embed.m4a', '-filter_complex', "[0:v]subtitles=filename='end.ass'[v_out]", '-map', '[v_out]', '-map', '1:a', '-c:v', 'h264_videotoolbox', '-c:a', 'copy', '-q:v', '67', '-movflags', '+faststart', '-shortest', 'laste_target.mp4']' returned non-zero exit status 8.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/util/_ffmpeg_runner.py", line 49, in runffmpeg

subprocess.run(

File "/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/lib/python3.10/subprocess.py", line 526, in run

raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command '['ffmpeg', '-hide_banner', '-nostdin', '-ignore_unknown', '-threads', '0', '-y', '-progress', 'compose1783953753.119594.txt', '-i', 'novoice.mp4', '-i', 'will_embed.m4a', '-filter_complex', "[0:v]subtitles=filename='end.ass'[v_out]", '-map', '[v_out]', '-map', '1:a', '-c:v', 'libx264', '-c:a', 'copy', '-crf', '23', '-preset', 'slow', '-movflags', '+faststart', '-shortest', 'laste_target.mp4']' returned non-zero exit status 8.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 277, in _join_video_audio_srt

runffmpeg(cmd0 + cmd1 + subtitle_filter + cmd2 + enc_qua + cmd3,

File "/Users/zt/pyvideotrans/videotrans/util/_ffmpeg_runner.py", line 78, in runffmpeg

raise FFmpegError(err) from e

videotrans.configure.excepts.FFmpegError: : Filter not found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/only_one.py", line 124, in run

trk.assembling()

File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 26, in assembling

self._join_video_audio_srt()

File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 280, in _join_video_audio_srt

raise VideoTransError(tr('Error in embedding the final step of the subtitle dubbing')+str(e)) from e

videotrans.configure.excepts.VideoTransError: 最后一步字幕配音嵌入时出错: Filter not found

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: /Users/zt/Downloads/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p.mp4,
输出结果保存到文件夹: /Users/zt/Downloads/_video_out/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p-mp4,
临时文件夹: /Users/zt/pyvideotrans/tmp/6871/c524117875
未选 清理已存在
未选 启用CUDA加速
未选 降噪
语音识别:faster-whisper(本地内置), model_name: large-v3-turbo, 发音语言: 英语, 断句方式:默认断句
翻译渠道:M2M100(本地内置),原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Qwen3-TTS(本地内置), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
已选 分离人声与背景声, 已选 重新嵌入背景声, 背景音量0.8, 背景声音时长 短于 视频时长时: 拉长(降速播放),存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:

错误原因是 macOS 上安装的 FFmpeg 缺少 subtitles 滤镜支持(该滤镜需要 libass 库),导致硬字幕嵌入失败。解决方案:重新安装带 libass 的 FFmpeg。在终端执行:brew reinstall ffmpeg --with-libass如果提示 --with-libass 已不再支持(Homebrew 新版本默认已启用),直接执行:brew reinstall ffmpeg然后验证是否已包含 subtitles 滤镜:ffmpeg -filters | grep subtitles输出应包含 subtitlesass 相关条目。重新安装后,重启 pyVideoTrans 并重新执行任务。如果仍然报错,可能是 ass 字幕文件路径包含特殊字符,可在 高级选项 -> 视频输出控制 中尝试更换硬字幕编码方式。但大概率是 FFmpeg 编译问题,按上述步骤即可解决。请查阅相关文档:MacOSX/Linux安装

最后一步字幕配音嵌入时出错: Filter not found
Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 423, in _subprocess

subprocess.run(

File "/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/lib/python3.10/subprocess.py", line 526, in run

raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command '['ffmpeg', '-nostdin', '-y', '-progress', 'compose1783954978.283427.txt', '-i', 'novoice.mp4', '-i', 'will_embed.m4a', '-filter_complex', "[0:v]subtitles=filename='end.ass'[v_out]", '-map', '[v_out]', '-map', '1:a', '-c:v', 'h264_videotoolbox', '-c:a', 'copy', '-q:v', '67', '-movflags', '+faststart', '-r', '23.976023976023978', '-fps_mode', 'cfr', '-shortest', 'laste_target.mkv']' returned non-zero exit status 8.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", li
......
plex', "[0:v]subtitles=filename='end.ass'[v_out]", '-map', '[v_out]', '-map', '1:a', '-c:v', 'h264_videotoolbox', '-c:a', 'copy', '-q:v', '67', '-movflags', '+faststart', '-r', '23.976023976023978', '-fps_mode', 'cfr', '-shortest', 'laste_target.mkv']' returned non-zero exit status 8.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/util/_ffmpeg_runner.py", line 49, in runffmpeg

subprocess.run(

File "/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/lib/python3.10/subprocess.py", line 526, in run

raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command '['ffmpeg', '-hide_banner', '-nostdin', '-ignore_unknown', '-threads', '0', '-y', '-progress', 'compose1783954978.283427.txt', '-i', 'novoice.mp4', '-i', 'will_embed.m4a', '-filter_complex', "[0:v]subtitles=filename='end.ass'[v_out]", '-map', '[v_out]', '-map', '1:a', '-c:v', 'libx264', '-c:a', 'copy', '-crf', '23', '-preset', 'slow', '-movflags', '+faststart', '-r', '23.976023976023978', '-fps_mode', 'cfr', '-shortest', 'laste_target.mkv']' returned non-zero exit status 8.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 277, in _join_video_audio_srt

runffmpeg(cmd0 + cmd1 + subtitle_filter + cmd2 + enc_qua + cmd3,

File "/Users/zt/pyvideotrans/videotrans/util/_ffmpeg_runner.py", line 78, in runffmpeg

raise FFmpegError(err) from e

videotrans.configure.excepts.FFmpegError: : Filter not found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/zt/pyvideotrans/videotrans/task/only_one.py", line 124, in run

trk.assembling()

File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 26, in assembling

self._join_video_audio_srt()

File "/Users/zt/pyvideotrans/videotrans/task/_stage_assemble.py", line 280, in _join_video_audio_srt

raise VideoTransError(tr('Error in embedding the final step of the subtitle dubbing')+str(e)) from e

videotrans.configure.excepts.VideoTransError: 最后一步字幕配音嵌入时出错: Filter not found

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: /Users/zt/Downloads/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p.mp4,
输出结果保存到文件夹: /Users/zt/Downloads/_video_out/YTDown.com_YouTube_How-the-Statue-of-Liberty-Got-Across-the_Media_H185YckFTdA_001_1080p-mp4,
临时文件夹: /Users/zt/pyvideotrans/tmp/7263/c524117875
未选 清理已存在
未选 启用CUDA加速
未选 降噪
语音识别:faster-whisper(本地内置), model_name: large-v3-turbo, 发音语言: 英语, 断句方式:默认断句
翻译渠道:M2M100(本地内置),原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Qwen3-TTS(本地内置), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
已选 分离人声与背景声, 已选 重新嵌入背景声, 背景音量0.8, 背景声音时长 短于 视频时长时: 拉长(降速播放),存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:

问题根源是 FFmpeg 缺少 subtitles 滤镜支持(缺少 libass 库),即使重新安装也无法解决。请按以下顺序排查并修复:

第一步:确认 FFmpeg 是否支持 subtitles 滤镜

在终端运行:

ffmpeg -filters | grep subtitles

如果输出为空或仅含 subtitles 但无 ass,说明 FFmpeg 未编译 libass。继续执行第二步。

第二步:彻底重装带 libass 的 FFmpeg

Homebrew 的 --with-libass 选项已废弃,改用以下方式强制编译:

brew uninstall ffmpeg
brew install ffmpeg --with-libass

如果 --with-libass 被拒绝,改用:

brew install ffmpeg

然后安装 libass:

brew install libass

注意:Homebrew 默认的 ffmpeg 公式在 macOS 上可能不包含 subtitles 滤镜,需要自行编译或使用第三方仓库。

第三步:使用静态编译的 FFmpeg(推荐)

如果 Homebrew 版本始终不支持 subtitles,请下载静态编译版:

  1. 访问 https://evermeet.cx/ffmpeg/ 下载 macOS 静态 FFmpeg。
  2. 替换 pyVideoTrans/ffmpeg/ 目录下的 ffmpeg 文件(注意备份原文件)。
  3. 赋予执行权限:chmod +x /path/to/ffmpeg

第四步:临时绕过硬字幕(应急方案)

在主界面 同步对齐和字幕 区域,选择 嵌入软字幕不嵌入字幕,跳过 subtitles 滤镜。软字幕会以独立轨道封装,播放器可手动开启。勾选后重新执行任务。

第五步:验证安装是否成功

/opt/homebrew/bin/ffmpeg -filters 2>/dev/null | grep subtitles

预期输出类似:

 ... subtitles    ...  ...  Render subtitles onto input video using the libass library.

如果仍有问题,请提供 ffmpeg -version 的完整输出。

zt@ztdeMac-mini ~ % ffmpeg -filters | grep subtitles
ffmpeg version 8.1.2 Copyright (c) 2000-2026 the FFmpeg developers
built with Apple clang version 17.0.0 (clang-1700.6.4.2)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/8.1.2_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libsvtav1 --enable-libopus --enable-libx264 --enable-libmp3lame --enable-libdav1d --enable-libvmaf --enable-libvpx --enable-libx265 --enable-openssl --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil 60. 26.102 / 60. 26.102
libavcodec 62. 28.102 / 62. 28.102
libavformat 62. 12.102 / 62. 12.102
libavdevice 62. 3.102 / 62. 3.102
libavfilter 11. 14.102 / 11. 14.102
libswscale 9. 5.102 / 9. 5.102
libswresample 6. 3.102 / 6. 3.102

确定当前的 FFmpeg 未编译 libass,因此无法使用 subtitles 滤镜。您的 ffmpeg -filters | grep subtitles 输出中并未包含相关行,确认无此滤镜。

请选择以下任一方案解决:

方案一:切换为「嵌入软字幕」(最快,无需重装 FFmpeg)

在主界面 同步对齐和字幕 区域,将「嵌入硬字幕」改为 「嵌入软字幕」,然后重新执行任务。软字幕不依赖 subtitles 滤镜,可正常生成带软字幕轨的 MKV/MP4,播放器可手动开关字幕。

方案二:安装带 libass 的静态 FFmpeg(推荐,可保留硬字幕功能)

手动下载并替换 FFmpeg 二进制文件:

  1. 访问 https://evermeet.cx/ffmpeg/,下载 ffmpeg-8.1.2-8k 或更新的静态版本(该版本内置 libass)。
  2. 将下载的 ffmpeg 文件复制到 pyVideoTrans 根目录下的 ffmpeg/ 文件夹中,覆盖原文件:

    cp ~/Downloads/ffmpeg /Users/zt/pyvideotrans/ffmpeg/ffmpeg
    chmod +x /Users/zt/pyvideotrans/ffmpeg/ffmpeg
  3. 重新运行软件,任务将自动使用新的 FFmpeg。

方案三:通过 Homebrew 重新编译 ffmpeg(可选,但可能较慢)

brew uninstall ffmpeg
brew install ffmpeg --with-libass   # 如果被拒绝,改用下面命令:
# 或手动安装 libass 后重新编译:
brew install libass
# 然后使用第三方 tap(如 homebrew-ffmpeg):
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-libass

安装后验证:ffmpeg -filters | grep subtitles 出现 subtitles 行即可。

验证步骤

无论选择哪种方案,完成后在终端执行以下命令确认 subtitles 滤镜可用:

/Users/zt/pyvideotrans/ffmpeg/ffmpeg -filters 2>/dev/null | grep subtitles

输出应类似:

subtitles   ...  Render subtitles onto input video using the libass library.

然后重启 pyVideoTrans。


优先推荐方案一(立即修复)或方案二(彻底解决问题,保留硬字幕)。

zt@ztdeMac-mini ~ % brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-libass
Usage: brew install [options] formula|cask [...]

Install a formula or cask. Additional options specific to a formula may be
appended to the command.

Unless $HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set, brew upgrade or brew
reinstall will be run for outdated dependents and dependents with broken
linkage, respectively.

Unless $HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run
for the installed formulae or, every 30 days, for all formulae.

Unless $HOMEBREW_NO_INSTALL_UPGRADE is set, brew install formula will
upgrade formula if it is already installed but outdated.

-d, --debug If brewing fails, open an interactive

                               debugging session with access to IRB or a
                               shell inside the temporary build directory.
  --display-times              Print install times for each package at the

......
N-based filters

  --with-rav1e                 ffmpeg:
                                   Enable AV1 encoding via librav1e
  --with-rtmpdump              ffmpeg:
                                   Enable RTMP dumping support
  --with-rubberband            ffmpeg:
                                   Enable rubberband library
  --with-two-lame              ffmpeg:
                                   Enable TwoLAME, an optimized MPEG Audio
                               Layer 2 (MP2) encoder
  --with-webp                  ffmpeg:
                                   Enable using libwebp to encode WEBP
                               images
  --with-whisper-cpp           ffmpeg:
                                   Enable OpenAI's Whisper speech
                               recognition model
  --with-xvid                  ffmpeg:
                                   Enable Xvid
  --with-zeromq                ffmpeg:
                                   Enable using libzeromq to receive cmds
                               sent through a libzeromq client
  --with-zimg                  ffmpeg:
                                   Enable z.lib zimg library
  --with-srt                   ffmpeg:
                                   Enable SRT library
  --with-libvmaf               ffmpeg:
                                   Enable libvmaf scoring library
  --with-libxml2               ffmpeg:
                                   Enable libxml2 library
  --with-libzvbi               ffmpeg:
                                   Enable decoding of DVB teletext pages and
                               DVB teletext subtitles
  --with-aribb24               ffmpeg:
                                   Build with aribb24 support
  --with-libbluray             ffmpeg:
                                   Build with libbluray support
  --with-libbs2b               ffmpeg:
                                   Build with libbs2b support
  --with-libcaca               ffmpeg:
                                   Build with libcaca support
  --with-libgsm                ffmpeg:
                                   Build with libgsm support
  --with-libtensorflow         ffmpeg:
                                   Build with libtensorflow support
  --with-openssl@3             ffmpeg:
                                   Build with openssl@3 support
  --with-speex                 ffmpeg:
                                   Build with speex support

-q, --quiet Make some output more quiet.
-h, --help Show this message.
Error: invalid option: --with-libass
Did you mean? with-librist

           with-librsvg
           with-libssh
           with-libbs2b
           with-libcaca
           with-libgsm

从您尝试安装的输出可见,homebrew-ffmpeg/ffmpeg 的公式不包含 --with-libass 选项,且 libass 并未出现在编译选项中。继续尝试编译会非常耗时且未必成功。建议采用以下两个方案中任一:方案一:立即修复——切换到「嵌入软字幕」在主界面 同步对齐和字幕 区域,将「嵌入硬字幕」改为「嵌入软字幕」,然后重新执行任务。软字幕不依赖 subtitles 滤镜,可正常生成带软字幕轨的 MKV/MP4 文件,播放器(如 VLC、IINA、QuickTime 等)可手动开启字幕。这是最快、最稳定的方案。方案二:彻底修复——使用静态 FFmpeg(替换二进制文件)下载已内置 libass 的静态 FFmpeg,替换软件自带的 ffmpeg:访问 https://evermeet.cx/ffmpeg/,点击「Download FFmpeg」获取最新静态版本(约 60MB)。下载后,将 ffmpeg 文件(无需安装)复制到 pyVideoTrans 的 ffmpeg/ 目录中:cp ~/Downloads/ffmpeg /Users/zt/pyvideotrans/ffmpeg/ffmpeg
chmod +x /Users/zt/pyvideotrans/ffmpeg/ffmpeg重启软件,任务将自动使用新的 FFmpeg,硬字幕功能即可正常工作。验证方法:/Users/zt/pyvideotrans/ffmpeg/ffmpeg -filters 2>/dev/null | grep subtitles此时应输出类似:subtitles ... Render subtitles onto input video using the libass library.强烈建议先使用方案一快速完成任务,后续再按方案二永久解决硬字幕问题。

依次在终端上执行这几个命令试试

    brew uninstall --ignore-dependencies ffmpeg
    
    brew tap homebrew-ffmpeg/ffmpeg
    
    brew install homebrew-ffmpeg/ffmpeg/ffmpeg

执行完毕后再执行ffmpeg -filters | grep subtitles 仔细看看输出中有没有 `subtitles V->V Render text subtitles
`

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Dondate via PayPal

Related resource