Introduction¶
Batch subtitle removal for videos usually requires opening the project in an external tool, manually selecting the subtitle area, and then exporting for comparison. A DSH plugin brings this workflow into the Harness window: it adds a “Subtitle Remover” entry to the left sidebar. Selecting a video, framing the area, and running the task are all completed on the same page, saving the trouble of switching back and forth between a desktop application and the command line. Below is an introduction to dsh-subtitle-remover, maintained by lijianbin2.
What is this¶
dsh-subtitle-remover is a plugin for DSH Web UI that adds a Subtitle Remover entry to the left sidebar, connecting the local video-subtitle-remover engine (abbreviated vsr) into Harness: screen selection, auto-recognition and model review, processing intervals, and real-time before/after comparison are all completed within the same page.
The plugin itself is only responsible for invoking the engine and does not bundle the engine code or models. The engine is an independent Apache-2.0 project. The plugin repository license is MIT, version 1.0.0.
Core Features¶
The page (main panel keyed by subtitle-remover) provides:
- Video path and directory selector, supporting drive letters, folders, video files, and size information.
- Resolution, fps, frame count, and duration read by
ffprobe. - Frame preview combined with start/end time intervals, and a region editor: drag inside the box to move, drag the bottom-right corner to resize, and view both the start and end frames.
- Mark multiple regions simultaneously (maximum 6), each region can be edited numerically.
- Auto region recognition: calls the engine’s built-in PP-OCR text detector on sampled frames, writes candidate boxes back to the same editor, and allows manual adjustment.
- Model review: after detection, the plugin can send candidate strips and video metadata to the DSH chat model for the model to judge which are real subtitles and which repair model to use. It defaults to the DSH model currently selected on the page, which can be switched.
- One-click
Run automatically: detection, model judgment, and starting the process all in one go. - Selection of repair model and subtitle detector, and an optional output directory.
- Processing interval: only rewrites frames within the interval, copying frames outside the interval unchanged.
- Real-time comparison preview: while the task is running, the engine’s preview hook writes throttled before/after JPEGs to the page, which displays the original frame and the repaired frame side-by-side, along with the frame number and percentage.
- Task progress, frame count, elapsed/remaining time, speed, output path, and copy.
- One-click open file or show folder after task completion, with entry points in both the task card and history row.
- Engine settings within the page: scan for common positions, manually select directory and interpreter (saved to the plugin directory, does not modify profile), and one-click install for machines without the engine (clone + virtual environment + PyTorch/PaddlePaddle).
A small animation will appear on the left sidebar entry when a task is running.
Installation and Enable¶
Installation consists of two steps: prepare the engine first, then add the plugin to DSH.
The steps provided in the README are as follows.
- Ensure
video-subtitle-removeris available on the same machine: models have been downloaded,config/config.jsonis in place, and Python hastorch/paddle/cv2installed. - Clone the plugin repository to a stable location. It automatically detects several layout variants;
vsrandvsr-envcan be inside the plugin directory, or in a sibling or parentplugins/directory (note that this is the recommended approach in the README, not the plugin install command):
cd <dir> # or <parent>\plugins
git clone https://github.com/lijianbin2/dsh-subtitle-remover
No configuration is required for either of the above layouts; the page installer defaults to the engine/ layout. Other layouts are also possible; you can set vsrRoot / pythonPath (see Configuration section) or point to them manually in the page.
3. Add to DSH: add this folder in the Plugins page, or call the plugin manager’s install_bundle, passing its absolute path.
4. Open the left sidebar entry Subtitle Remover.
Configuration¶
All configuration items are optional. The plugin will first automatically detect the checkout and interpreter (<workspace>/vsr, <workspace>/vsr-env/Scripts/python.exe).
- id: dsh-subtitle-remover
name: dsh-subtitle-remover
config:
vsrRoot: 'D:\tools\video-subtitle-remover' # Directory containing backend/main.py
pythonPath: 'D:\tools\vsr-env\Scripts\python.exe'
ffmpegPath: 'C:\ffmpeg\bin\ffmpeg.exe' # For preview frames; otherwise uses the bundled copy from checkout
ffprobePath: 'C:\ffmpeg\bin\ffprobe.exe' # Only used for reading video metadata
defaultDir: 'D:\videos'
defaultMode: 'sttn-auto'
defaultDetect: 'server' # or 'mobile'
Priority: Directory saved in the page -> Configuration above -> Auto-detection. Manual selection is saved in <DSH_HOME>/data/dsh-subtitle-remover/settings.json and remains valid after plugin updates.
Auto-detection will look for the video-subtitle-remover checkout and its virtual environment next to the plugin, in ~, ~/Documents, ~/projects, or the workspace directory. The one-click install defaults to engine/video-subtitle-remover inside the plugin directory; this can be changed if desired. It requires git and Python 3.10+ in the command line and will download several GBs of content. Note that model files are not in the engine repository: after installing the engine, you must copy backend/models from the video-subtitle-remover release archive (or an existing installation) into the cloned directory; the page will explicitly prompt for missing files.
Communication with the Engine¶
The Host side starts the script under runner/ using the interpreter from the local checkout. Both output JSON events line-by-line on a private channel (@@VSR@@ {...}); the engine’s own tqdm/paddle output goes to stderr:
vsr_runner.pyremoves subtitles, one--areaper marked region.vsr_detect.pysamples frames, clusters detected text boxes into strips, and reports them as percentages. Strips are sorted by width, horizontal centering, and frame hit count; this ensures that HUD text (ammo count, kill feed, minimap) does not obscure wide, centered subtitle lines.
The page polls /dsh-subtitle-remover/api/* on the Harness webServer (same-origin binding, validates loopback and same-origin):
| Route | Purpose |
|---|---|
GET /state |
Environment status, tasks, currently running detection |
GET /jobs, GET /jobs/<id> |
Task list / Single task with logs |
POST /jobs, POST /jobs/<id>/cancel, POST /jobs/<id>/remove |
Task lifecycle |
GET /browse?path= |
Directory list for the selector |
GET /probe?path= |
Read video metadata via ffprobe |
GET /frame?path=&t= |
Retrieve a frame JPEG preview via ffmpeg |
GET /jobs/<id>/preview/left\|right |
Real-time before/after comparison frames |
POST /jobs/<id>/open |
Open output file or containing folder using system handle |
GET /models |
DSH model directory and currently selected item |
POST /detect, GET /detect/<id>, POST /detect/<id>/cancel |
Automatic region detection (optional model review) |
Typical Usage¶
The README provides two paths: manual and automatic.
Manual flow: Open Subtitle Remover, select a video, frame the subtitle area on the frame preview (up to 6), set the processing interval, select the repair model and subtitle detector, and then start the task. You can see the before/after comparison directly on the task card while running, and open the final result from the task card or history row after it ends.
Automatic flow: Click Run automatically. The plugin first samples frames for PP-OCR detection, sends the candidate strips to the DSH chat model to judge if they are subtitles and which repair model to use, and then starts running in one go. You can also run detection only, confirm or adjust in the editor, and then start.
On machines where the engine is not installed, you can first click one-click install in the page, copy backend/models into the clone directory, and then return to the page to select the engine directory.
Applicable Scenarios and Notes¶
It is suitable for developers who already use DSH and need to remove embedded subtitles in the same workflow, especially those who want to use a local engine and do not rely on cloud inference. In terms of classification, it belongs to model inference, as the actual detection and repair are completed by the local video-subtitle-remover’s torch / paddle environment; the page is only responsible for orchestration and display.
A few notes:
- The plugin runs with the permissions of the current dsh process. One-click install will execute git clone, create a virtual environment, and install PyTorch / PaddlePaddle. Before installing, you should check the plugin source code and license (plugin is MIT, engine is Apache-2.0).
- The engine depends on a local environment: torch / paddle / cv2, optional CUDA or CPU version of PyTorch,
ffmpeg(bundled copy from checkout) andffprobe. - Model files must be obtained from the release archive or an existing installation; the engine repository does not contain them.
- One-click install will download several GBs of content and requires
gitand Python 3.10+ inPATH.
Summary¶
The value of dsh-subtitle-remover lies in bringing the local video-subtitle-remover engine into the Harness sidebar: selecting the video, framing, model judgment, real-time comparison, and interval output are all completed in one page, without changing the way the engine itself runs. The directory page is at https://www.skillhub.cn/plugins/lijianbin2/dsh-subtitle-remover, and the repository is at https://github.com/lijianbin2/dsh-subtitle-remover. The DSH plugin directory is a community site and has no official affiliation with DeepSeek / Huansuan; it is recommended to follow the repository README before installing.