メインコンテンツへスキップ
F

dsh-asr

f-sheng/dsh-asr

Transcribes a local video or audio file into a plain-text script and an SRT subtitle file using a local sherpa-onnx engine, chunking long files and keeping the timeline aligned.

インストール

dsh plugin --profile web add github:f-sheng/dsh-asr

README

dsh-asr

Local, offline speech-to-text for DeepSeek Harness. Turn a video or audio file into a plain-text script and an SRT subtitle file with a local sherpa-onnx engine. No API key, no per-minute cost, nothing uploaded.

中文说明

What it gives you

Two tools, available to the agent as soon as the plugin is enabled:

ToolWhat it does
asr_transcribeVideo/audio file → .txt transcript + .srt subtitles
asr_statusReports whether the engine, Python, ffmpeg and model files are ready

Output files land next to the source by default. Long files are chunked at 40 s and the timeline is reassembled client-side, so timestamps do not drift.

Install

1. Add the plugin

npx dsh plugins add dsh-asr        # if published to npm
# or point Plugins > Add plugin at a local checkout

2. Install the engine once (about 1 GB, one time)

node node_modules/dsh-asr/bin/setup.mjs

It installs sherpa-onnx + flask into Python and downloads the Chinese paraformer model plus the silero VAD model into ~/.dsh/asr-models/. Re-runs are incremental.

ffmpeg must be on PATH (or set ffmpegPath in the plugin config). Windows: winget install ffmpeg.

3. Use it

asr_transcribe({ input: "D:\\video\\ep01.mp4" })

Configuration

Every field is optional; defaults are discovered automatically.

- insert:
    - id: dsh-asr
      name: dsh-asr
      config:
        port: 8765
        pythonPath: 'C:\Python312\python.exe'
        ffmpegPath: 'C:\ffmpeg\bin\ffmpeg.exe'
        modelDir: 'E:\models\sherpa-onnx-paraformer-zh-2024-03-09'
        vadModel: 'E:\models\silero_vad.onnx'
        dataDir: 'C:\Users\me\.dsh\asr'

How it works

video/audio ──ffmpeg──▶ 16 kHz mono WAV (40 s chunks)
                            │
                            ▼
                sherpa-onnx + paraformer (standalone Python process)
                            │
                      VAD → sentence segments
                            │
                            ▼
                timestamped segments ──┬── .txt
                                       └── .srt

The recogniser listens on 127.0.0.1 only. The plugin spawns it detached on first use and reuses the same process afterwards, so DSH restarts do not pay the cold-start cost again.

Limitations

  • Chinese model only. Point modelDir at another paraformer language build to switch.
  • Proper nouns get misheard. A 217 MB quantised model is unstable on homophones, names and jargon. Cross-check numbers and names against the source before quoting them.
  • No speaker diarisation. Multi-speaker audio comes back as one continuous string.
  • Music can hallucinate a line. VAD reduces it a lot, but review music-heavy sections.
  • Windows is the tested path. On Linux/macOS set pythonPath / ffmpegPath explicitly.

License

MIT

関連プラグイン