功能建议:添加 FunASR 作为可选 ASR 引擎

Author: LauraGPTCreated May 29, 2026Updated Sep 22, 2026

Goal

Add a self-hosted speech-to-text option for VideoCaptioner users who want local Chinese and multilingual transcription without sending audio to a hosted API.

Accepted scope

Use FunASR's local Python runtime with iic/SenseVoiceSmall as the default checkpoint:

  • Chinese, Cantonese, English, Japanese, and Korean transcription;
  • automatic language selection or an explicit supported language;
  • timestamp output when the model response provides aligned words;
  • a separately loaded fsmn-vad model for long-audio segmentation;
  • CPU, CUDA, or MPS selection where the installed PyTorch runtime supports it;
  • no API key and no external transcription service.

FunASR is a toolkit whose checkpoints have different language, timestamp, punctuation, streaming, and runtime capabilities. This issue does not treat every FunASR model as having the same features.

Implementation

PR #1163 adds:

  • a local SenseVoiceASR provider with lazy loading, cache reuse, serialized inference, and 20-minute chunking;
  • CLI flags plus TOML and environment-variable configuration;
  • desktop settings that appear only when the complete optional runtime (funasr, torch, and torchaudio) is installed;
  • encoded-audio normalization and focused unit tests;
  • an optional installation extra: pip install 'videocaptioner[sensevoice]'.

The desktop release workflow does not currently bundle the PyTorch/FunASR runtime. Dependency gating prevents packaged builds from showing a provider that cannot run.

Out of scope for this issue

  • the FunASR OpenAI-compatible HTTP server;
  • Paraformer integration;
  • speaker diarization;
  • fixed speed comparisons across hardware or checkpoints.

Those can be evaluated separately with their own runtime, packaging, and acceptance tests.

Acceptance criteria

  • Local SenseVoice transcription works through the existing transcription pipeline.
  • Missing optional dependencies produce an installation hint in the CLI and hide the provider in the desktop UI.
  • Model/device settings round-trip through CLI TOML and environment variables.
  • Focused tests cover dependency gating, transcription parsing, encoded audio, configuration, and preflight errors.

Source: WEIFENG2333/VideoCaptioner