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

240e:39c* Posted at: 5 hours 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 "videotrans\recognition\_whispernet.py", line 269, in _exec
System.MissingMethodException: 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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\only_one.py", line 47, in run
File "videotrans\task\_stage_recogn.py", line 62, in recogn
File "videotrans\recognition\__init__.py", line 205, in run
File "videotrans\recognition\_base.py", line 91, in run
File "videotrans\recognition\_whispernet.py", line 285, in _exec
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:/迅雷下载/修复/1-mp4,
临时文件夹: F:/pyvideotrans/tmp/36252/5c7d88d507
已选 清理已存在
未选 启用CUDA加速
已选 降噪
已选 识别说话人,最大说话人数量3
语音识别:Whisper.NET, model_name: ggml-large-v3.bin, 发音语言: 英语, 断句方式:默认断句
翻译渠道:兼容AI/本地模型,原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Qwen3-TTS(本地内置), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
已选 分离人声与背景声,存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:


=
system:Windows-10-10.0.26100-SP0
version:v4.06
frozen:True
language:zh
root_dir:F:/pyvideotrans

5 Replies

这是由于 Whisper.NET 所需的 .NET 运行时版本过低导致的 System.TimeSpan.FromMilliseconds(Int64) 方法缺失。

解决方案:

  1. 安装 .NET 6 或更高版本的 Desktop Runtime
    前往微软官方下载页面:https://dotnet.microsoft.com/download/dotnet/6.0
    选择 .NET Desktop Runtime 6.0 (x64) 安装后,重启软件。
  2. 若问题依旧,可临时更换语音识别渠道(如 faster-whisper(本地内置)),避免使用 Whisper.NET。

image

无法直接查看您上传的图片。请描述图片中的内容,例如是否显示了新的错误提示、软件界面异常,或安装 .NET 6 时的失败信息。这对定位问题至关重要。

安装了10.0.10的.net ,环境变量设置正确了,错误如下:
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 "videotra
......
ig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
Traceback (most recent call last):
File "videotrans\recognition\_whispernet.py", line 269, in _exec
System.MissingMethodException: 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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\only_one.py", line 47, in run
File "videotrans\task\_stage_recogn.py", line 62, in recogn
File "videotrans\recognition\__init__.py", line 205, in run
File "videotrans\recognition\_base.py", line 91, in run
File "videotrans\recognition\_whispernet.py", line 285, in _exec
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:/迅雷下载/修复/1-mp4,
临时文件夹: F:/pyvideotrans/tmp/30588/5c7d88d507
已选 清理已存在
未选 启用CUDA加速
已选 降噪
已选 识别说话人,最大说话人数量3
语音识别:Whisper.NET, model_name: ggml-large-v3.bin, 发音语言: 英语, 断句方式:默认断句
翻译渠道:兼容AI/本地模型,原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Qwen3-TTS(本地内置), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
已选 分离人声与背景声,存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:

您的 .NET 版本为 10.0.10,而 Whisper.NET 库要求的是 .NET 6.0 Desktop Runtime(x64)。不兼容的运行时版本会导致 FromMilliseconds(Int64) 方法缺失。

解决方案 ①:安装正确的 .NET 运行时

  1. 前往微软官方下载 .NET 6.0 Desktop Runtime (x64):
    https://dotnet.microsoft.com/download/dotnet/6.0
    选择 .NET Desktop Runtime 6.0 (x64)(不是 SDK,也不是 ASP.NET Core)。
  2. 安装后重启电脑。

解决方案 ②:切换语音识别渠道(临时规避)
如果仍需立即使用,请将语音识别渠道改为 faster-whisper(本地内置)openai-whisper(本地内置),并选择模型 large-v3。这两个渠道更稳定,无需依赖 .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