Preface¶
When handling subtitles in DSH, common practices include reading the entire SRT text, using regular expressions to modify timestamps, or letting the model derive arithmetic such as “a global offset of 2.5 seconds, with increasing drift later on.” The three formats—SRT, VTT, and ASS—have different timestamp syntaxes, and the field order in ASS’s Dialogue: lines depends on the Format: line. A single typo or position-based reading can cause player rejection and make it difficult for the model to reason about “which lines are too close” or “which entry is 20 seconds long.”
The following introduces the community plugin yuehancn/dsh-tool-subtitle (Maintainer: yuehancn, Category: Model Reasoning): It provides 7 structured tools for DeepSeek Harness, covering transcription, mutual conversion, time adjustment, and pre-release inspection. It transforms subtitle processing from “a bunch of regexes” into “queryable and editable” local operations. The README states that parsing and time adjustment logic have been verified against real @deepseek-ai/dsh-tools and subprocesses using 291 assertions, without mocking byte-level parsing.
What is this¶
dsh-tool-subtitle is a custom tool plugin for DeepSeek Harness: it reads and writes subtitles as a list of cues with numeric timestamps (JSON), converts between SRT / VTT / ASS, performs global shifting and scaling, and converts audio/video to SRT when an optional ASR command is bound. Even without a recognition engine configured, reading, writing, converting, time adjustment, and inspection can still be completed locally.
- Directory Page: https://www.skillhub.cn/plugins/yuehancn/dsh-tool-subtitle
- Source Code & Docs: https://github.com/yuehancn/dsh-tool-subtitle
- License: MIT (package.json version 1.0.0)
- Compatibility: The README specifies it is built and tested for dsh
0.2.0-rc.2(preview); theapply(ctx)plugin spec is stable, but newer versions should be verified independently.
The community plugin directory (SkillHub) is not officially affiliated with DeepSeek / High-Flyer; it is recommended to review the source code and license before installation. The plugin runs with the permissions of the current dsh process, reading and writing only the inputs you specify and the configured outputDir, while the recognition engine is an executable configured on your local machine.
What the Seven Tools Do¶
| Tool | Function |
|---|---|
subtitle_status |
Probes for available local recognition engines and lists readable/writable subtitle dialects |
subtitle_read |
Reads subtitles into a structured cue list with numeric timestamps |
subtitle_write |
Writes a cue list back to a file (timestamps can be seconds or strings) |
subtitle_convert |
SRT ↔ VTT ↔ ASS conversion, with options for time adjustment, merging, and splitting |
subtitle_retime |
Global shift + scaling, handling fixed offsets and time drift |
subtitle_check |
Pre-release inspection: too long, too short, too fast reading speed, overlaps, empty text, Traditional Chinese, etc. |
subtitle_transcribe |
Converts audio/video to subtitles using a configured ASR command |
subtitle_read returns JSON rather than large blocks of text to allow the model to reason based on a numeric timeline (gaps, individual durations, holes, etc.). subtitle_retime is a standalone tool to unify “offset + drift” into time × factor + offset, avoiding the need to derive this arithmetic every time.
The default criteria for subtitle_check include: single cue exceeding 7 seconds (too-long), shorter than 0.8 seconds (too-short), reading speed exceeding 9 characters/second (too-fast), time overlap, non-positive duration, empty text, and potential Traditional Chinese specific characters, etc.; thresholds can be adjusted in the configuration.
Installation and Activation¶
First, run a one-line installation (command from the README; supported for both desktop and web profiles), then restart dsh after installation.
dsh plugin --profile desktop add github:yuehancn/dsh-tool-subtitle
For the Web version, replace --profile desktop with web. The plugin is registered via cordis.patch.yml with the id tool-subtitle.
Configuring the Recognition Engine (Optional)¶
Transcription depends on the ASR command configured in the patch under your profile; if left empty, subtitle_transcribe is unavailable, but other tools work as usual.
Configuration is written in ~/.dsh/profiles/<profile>/cordis.patch.yml. The example structure is as follows (modify paths according to your local machine):
- id: tool-subtitle
config:
outputDir: C:/Users/you/Videos/subtitle-output
asrCommand: C:/Users/you/.local/bin/whisper-faster.exe
asrArgs:
- "{input}"
- "--model"
- "{model}"
- "--output_dir"
- "{dir}"
- "--output_format"
- "srt"
- "--language"
- "{lang}"
asrModel: D:/models/whisper
asrLanguage: zh
asrArgs placeholders: {input} is the absolute path of the input audio/video, {output} is the desired SRT path, {dir} is the plugin output directory, {lang} / {model} are language and model. The README explains that if the engine does not recognize {output} and only writes to --output_dir, the plugin will rename the artifact to your required output name; if no SRT is generated after execution, the error message will include the full command line actually executed.
Summary of common configuration items:
| Config Item | Default | Description |
|---|---|---|
outputDir |
subtitle-output |
Artifact directory |
timeoutMs |
1800000 | Timeout per call (30 minutes) |
asrCommand |
Empty | Disables transcription if empty |
asrModel / asrLanguage |
large-v3 / zh |
Passed to placeholders |
maxCueSeconds / minCueSeconds |
7 / 0.8 | Inspection thresholds |
maxCharsPerSecond |
9 | Reading speed limit |
maxCues |
500 | Max cues for single inline return |
status/read/…/check |
true |
Can disable individual tools as needed |
Subprocesses use spawn(command, argsArray) and do not concatenate shell strings; the recognition engine needs to be installed separately, and the plugin does not download models.
Typical Usage Ideas¶
The README does not provide fixed dialogue examples, but the toolchain can be combined in the following order within Harness (replace paths and formats according to the task):
subtitle_status: Confirm local ASR and supported read/write formats.subtitle_transcribe(ifasrCommandis configured): Audio/video → SRT.subtitle_check: Check for too long, overlaps, Traditional Chinese, etc., before release.subtitle_retime: Add 2.5 seconds globally or fix drift by factor.subtitle_convert: Export VTT / ASS, or merge and split timelines.subtitle_read/subtitle_write: Modify subtitles on the cue list and write back.
The project’s e2e tests describe a full chain of “transcribe → check → split → retime → VTT → ASS → read back”; to run tests locally, use the command in the README (depends on @deepseek-ai packages within the installed dsh profile; e2e uses a stand-in engine _test/fixtures/mock-asr.mjs, no real model required).
Suitable Scenarios and Notes¶
Suitable for: Scenarios requiring stable handling of SRT/VTT/ASS within DSH agent workflows, timeline adjustment, batch subtitle inspection, and optional integration with any “input media, output SRT” ASR executable (whisper.cpp, faster-whisper, etc., the plugin is not bound to a single engine).
Notes:
- Tested in alignment with dsh
0.2.0-rc.2; tool schemas and behavior should be verified after upgrading dsh. - Transcription can be time-consuming; the default
timeoutMsis 30 minutes. - Installing the plugin implies trusting it to read/write local files and spawn the ASR you configured; please read the source code under the MIT license before use.
- GitHub stars are 0 (directory clue), which does not imply functional completeness; quality is subject to the test descriptions in the README.
Conclusion¶
dsh-tool-subtitle consolidates subtitle-related format parsing, timeline arithmetic, and inspection rules into 7 DSH tools. It can complete reading, writing, conversion, and time adjustment without ASR; once asrCommand is configured, it completes transcription and subsequent processing within the same toolset.
- Community Directory: https://www.skillhub.cn/plugins/yuehancn/dsh-tool-subtitle
- GitHub: https://github.com/yuehancn/dsh-tool-subtitle