#5645 语音识别阶段出错[Huggingface_ASR(本地内置)] Could not load libtorchcodec. Likely causes: 1. FFmpeg is not properly installed in

185.119* Posted at: 20 hours ago

语音识别阶段出错[Huggingface_ASR(本地内置)] Could not load libtorchcodec. Likely causes:

      1. FFmpeg is not properly installed in your environment. We support
         versions 4, 5, 6, 7, and 8, and we attempt to load libtorchcodec
         for each of those versions. Errors for versions not installed on
         your system are expected; only the error for your installed FFmpeg
         version is relevant. On Windows, ensure you've installed the
         "full-shared" version which ships DLLs.
      2. The PyTorch version (2.7.1+cu128) is not compatible with
         this version of TorchCodec. Refer to the version compatibility
         table:
         https://github.com/pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec.
      3. Another runtime dependency; see exceptions below.

    The following exceptions were raised as we tried to load libtorchcodec:
    

[start of libtorchcodec loading traceback]
FFmpeg vers
......
t found when the application was frozen.

FFmpeg version 6:
Traceback (most recent call last):
File "pyimod03_ctypes.py", line 53, in init
File "ctypes\__init__.py", line 374, in init
FileNotFoundError: Could not find module 'E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\libtorchcodec_core6.dll' (or one of its dependencies). Try using the full path with constructor syntax.

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

Traceback (most recent call last):
File "E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries

torch.ops.load_library(core_library_path)

File "torch\_ops.py", line 1392, in load_library

ctypes.CDLL(path)

File "pyimod03_ctypes.py", line 55, in init
pyimod03_ctypes.install..PyInstallerImportError: Failed to load dynlib/dll 'E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\libtorchcodec_core6.dll'. Most likely this dynlib/dll was not found when the application was frozen.

FFmpeg version 5:
Traceback (most recent call last):
File "pyimod03_ctypes.py", line 53, in init
File "ctypes\__init__.py", line 374, in init
FileNotFoundError: Could not find module 'E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\libtorchcodec_core5.dll' (or one of its dependencies). Try using the full path with constructor syntax.

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

Traceback (most recent call last):
File "E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries

torch.ops.load_library(core_library_path)

File "torch\_ops.py", line 1392, in load_library

ctypes.CDLL(path)

File "pyimod03_ctypes.py", line 55, in init
pyimod03_ctypes.install..PyInstallerImportError: Failed to load dynlib/dll 'E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\libtorchcodec_core5.dll'. Most likely this dynlib/dll was not found when the application was frozen.

FFmpeg version 4:
Traceback (most recent call last):
File "pyimod03_ctypes.py", line 53, in init
File "ctypes\__init__.py", line 374, in init
FileNotFoundError: Could not find module 'E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\libtorchcodec_core4.dll' (or one of its dependencies). Try using the full path with constructor syntax.

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

Traceback (most recent call last):
File "E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\_internally_replaced_utils.py", line 93, in load_torchcodec_shared_libraries

torch.ops.load_library(core_library_path)

File "torch\_ops.py", line 1392, in load_library

ctypes.CDLL(path)

File "pyimod03_ctypes.py", line 55, in init
pyimod03_ctypes.install..PyInstallerImportError: Failed to load dynlib/dll 'E:\AI\Trans-Movie\win-pyvideotrans\_internal\torchcodec\libtorchcodec_core4.dll'. Most likely this dynlib/dll was not found when the application was frozen.
[end of libtorchcodec loading traceback].
cfg=TaskCfgSTT(uuid='50d3136a56', name='E:/AI/movie/JUR-366.mp4', dirname='E:/AI/movie', noextname='JUR-366', basename='JUR-366.mp4', ext='mp4', target_dir='E:/AI/Trans-Movie/win-pyvideotrans/output/recogn', cache_folder='E:/AI/Trans-Movie/win-pyvideotrans/tmp/32944/50d3136a56', is_cuda=True, source_language=None, source_language_code=None, source_sub=None, source_wav=None, source_wav_output=None, target_language=None, target_language_code=None, target_sub='E:/AI/Trans-Movie/win-pyvideotrans/output/recogn/JUR-366.srt', target_wav=None, target_wav_output=None, detect_language='ja', recogn_type=8, model_name='kotoba-tech/kotoba-whisper-v2.0', shibie_audio='E:/AI/Trans-Movie/win-pyvideotrans/tmp/32944/50d3136a56/JUR-366-1783302465.4492316.wav', remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=0, fix_punc=0)

1 Replies

这是 Huggingface_ASR(本地内置) 渠道的依赖 torchcodec 加载失败导致的。通常原因是软件打包不完整或相关 DLL 被防病毒软件误删/隔离。

解决方法:

  1. 确认使用的是完整版:检查软件目录大小是否为 2.6GB+。如果只有 260MB,说明你下载的是补丁包而不是完整包。请从官网下载完整压缩包并重新解压。
  2. 检查杀毒软件:将整个软件文件夹加入杀毒软件/Windows Defender 的白名单,然后重新解压覆盖。
  3. 更换 ASR 渠道Huggingface_ASR 对打包环境要求较高,且你使用的 kotoba-tech/kotoba-whisper-v2.0 模型依赖 torchcodec。对于日语视频,推荐改用以下渠道(无需 torchcodec):

    • faster-whisper(本地内置) + 模型 large-v3(速度与质量均衡)
    • openai-whisper(本地内置) + 模型 large-v3(准确度略高)
    • parakeet日语(本地内置)(英伟达开源日语模型,效果好)

请查阅相关文档:

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: ko-fi.com/jianchang512

Related resource