#5997 Whisper.net recognition failed: Method not found: 'System.TimeSpan System.TimeSpan.FromMilliseconds(Int64)'. at Whispe

240e:39c* Posted at: 1 day ago

Whisper.net recognition failed: Method not found: 'System.TimeSpan System.TimeSpan.FromMilliseconds(Int64)'.
at Whisper.net.WhisperProcessor.OnNewSegment(IntPtr state)
at Whisper.net.WhisperProcessor.OnNewSegmentStatic(IntPtr ctx, IntPtr state, Int32 nNew, IntPtr userData)
at Whisper.net.Internals.Native.Implementations.LibraryImportLibWhisper.whisper_full_with_state(IntPtr context, IntPtr state, WhisperFullParams parameters, IntPtr samples, Int32 nSamples)
at Whisper.net.WhisperProcessor.Process(ReadOnlySpan`1 samples)
at Whisper.net.WhisperProcessor.Process(Single[] samples)
at Whisper.net.WhisperProcessor.Process(Stream waveStream)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
Traceback (most recent call last):
File "H:\pyvideotrans\videotrans\recognition\_wh
......
= run_recogn(
File "H:\pyvideotrans\videotrans\recognition\__init__.py", line 205, in run

return _cls(**kwargs).run()  # type:ignore

File "H:\pyvideotrans\videotrans\recognition\_base.py", line 92, in run

res = self._exec()

File "H:\pyvideotrans\videotrans\recognition\_whispernet.py", line 285, in _exec

raise SpeechToTextError(f"Whisper.net recognition failed: {str(e)}")

videotrans.configure.excepts.SpeechToTextError: Whisper.net recognition failed: Method not found: 'System.TimeSpan System.TimeSpan.FromMilliseconds(Int64)'.
at Whisper.net.WhisperProcessor.OnNewSegment(IntPtr state)
at Whisper.net.WhisperProcessor.OnNewSegmentStatic(IntPtr ctx, IntPtr state, Int32 nNew, IntPtr userData)
at Whisper.net.Internals.Native.Implementations.LibraryImportLibWhisper.whisper_full_with_state(IntPtr context, IntPtr state, WhisperFullParams parameters, IntPtr samples, Int32 nSamples)
at Whisper.net.WhisperProcessor.Process(ReadOnlySpan`1 samples)
at Whisper.net.WhisperProcessor.Process(Single[] samples)
at Whisper.net.WhisperProcessor.Process(Stream waveStream)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: G:/1.mp4,
输出结果保存到文件夹: G:/_video_out/1-mp4,
临时文件夹: H:/pyvideotrans/tmp/16548/5c7d88d507
已选 清理已存在
未选 启用CUDA加速
未选 降噪
已选 识别说话人,最大说话人数量3
语音识别:Whisper.NET, model_name: ggml-large-v3-turbo.bin, 发音语言: 英语, 断句方式:默认断句
翻译渠道:微软(免费),原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Spark-TTS(本地API), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
已选 分离人声与背景声,存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:


=
system:Windows-10-10.0.26100-SP0
version:v4.06
frozen:False
language:zh
root_dir:H:/pyvideotrans
Python: 3.10.19 (main, Oct 28 2025, 12:01:56) [MSC v.1944 64 bit (AMD64)]

1 Replies

Whisper.net 报错 Method not found: 'System.TimeSpan System.TimeSpan.FromMilliseconds(Int64)' 的根本原因是系统中安装的 .NET 运行时版本过低,缺少该 API 重载(该方法在 .NET 6+ 中才支持 Int64 参数)。

解决方案:

  1. 安装 .NET 8.0 Runtime(推荐)
    前往 https://dotnet.microsoft.com/en-us/download/dotnet/8.0 下载安装 .NET Desktop Runtime 8.0.x (x64)
    安装后重启电脑。
  2. 重新安装 Whisper.net 依赖
    在源码目录下执行:

    uv sync --extra dotnet

    确保 pythonnet>=3.0.1 已正确安装。

  3. 验证安装
    打开命令提示符,输入 dotnet --info,确认显示已安装的 .NET 版本为 8.x。
  4. 替代方案
    若仍无法解决,建议切换为 faster-whisper(本地内置) 渠道,它不依赖 .NET,且对相同模型支持更好。

请查阅相关文档:

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