Skip to content

Commit f3b5f98

Browse files
committed
proj: update README
1 parent 6e4752b commit f3b5f98

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

README-zh_CN.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#### 源码安装
3232

33-
1. 安装[Python](https://www.python.org) 3.12.6或更高版本(需<3.13),64位版本
33+
1. 安装[Python](https://www.python.org) 3.12.8或更高版本(需<3.13),64位版本
3434
2. 运行`install.bat`(Windows)或`install.sh`(GNU/Linux或macOS),该脚本将自动在Python虚拟环境中安装`requirements.txt`列出的依赖项
3535
3. *(仅需执行`ocr`额外任务时,基础时间轴生成无需此步骤)* 安装Tesseract OCR v5.3.3.20231005或更高版本
3636

@@ -40,7 +40,7 @@
4040

4141
新手推荐配置:
4242
-`source`部分指定输入视频文件路径
43-
- 设置`strategy``bcs``preset``default`(默认值)
43+
- 设置`strategy``dtd``preset``default`(默认值)
4444
- 设置`engine``speculative`(默认值)
4545

4646
**调试运行**:通过调试模式验证字幕区域是否在检测窗口内
@@ -49,7 +49,7 @@
4949
-`engine`改为`framewise`
5050
-`framewise`部分设置`debug``true`(默认值)
5151

52-
下一步运行`MagiaTimeline.bat`/`MagiaTimeline.exe`(Windows)或`MagiaTimeline.sh`(GNU/Linux或macOS)。会有一个弹出窗口显示正在处理的帧,底部一个有红色框,请确认字幕出现在框内。如果有超出框的字幕,请调整`bcs``default`下的`dialogRect`参数并重新运行。调试模式不用等整个视频打完轴,按`q`键可随时退出检测窗口。
52+
下一步运行`MagiaTimeline.bat`/`MagiaTimeline.exe`(Windows)或`MagiaTimeline.sh`(GNU/Linux或macOS)。会有一个弹出窗口显示正在处理的帧,底部一个有红色框,请确认字幕出现在框内。如果有超出框的字幕,请调整`dtd``default`下的`dialogRect`参数并重新运行。调试模式不用等整个视频打完轴,按`q`键可随时退出检测窗口。
5353

5454
如果视频分辨率过高,调试窗口在屏幕上显示不下,可以调整`framewise`下的`debugPyrDown`参数。
5555

@@ -63,8 +63,9 @@
6363

6464
MagiaTimeline提供两款推荐的通用策略组:
6565

66-
- **颜色统计(bcs)**:基于文本检测、颜色统计和特征提取的算法。该策略组适用于多数视频且无需调参,首选推荐。
67-
- **轮廓检测(otl)**:依赖特定文本颜色、轮廓颜色和粗细参数的算法。速度显著快于`bcs`,但需要手动调整参数。
66+
- **差分文字检测(`dtd`**: 通过对画面变化部分(差分)执行文本检测从而判断字幕变化的算法。该策略组适用于多数视频且无需调参,首选推荐。
67+
- **颜色统计(`bcs`**:通过对文本检测框定的区域执行颜色统计从而检测文本变化的算法。该策略组可以作为`dtd`失效时的后备选项。
68+
- **轮廓检测(`otl`**:依赖特定文本颜色、轮廓颜色和粗细参数的算法。速度显著快于`bcs`,但需要手动调整参数。
6869

6970
除此之外,MagiaTimeline针对几种特定视频类型开发了专用策略组,这几个策略组处理速度快、精度高,但无法泛用:
7071

@@ -79,17 +80,13 @@ MagiaTimeline提供两款推荐的通用策略组:
7980
处理引擎(Engine)决定策略组处理视频时的帧采样方式。MagiaTimeline提供两种引擎:
8081

8182
- **逐帧扫描(Framewise)**:检测每一帧(或者每隔几帧抽一帧),提取信息后连接为字幕区间。该引擎速度较慢,但支持全部策略组。调试模式下可显示实时处理画面,便于调参。
82-
- **二分跳帧(Speculative)**:通过二分法查找字幕变化前后的帧,跳过中间字幕不变的帧。该引擎速度约为逐帧扫描的20倍,但仅支持`bcs``otl`策略组。
83+
- **二分跳帧(Speculative)**:通过二分法查找字幕变化前后的帧,跳过中间字幕不变的帧。该引擎速度约为逐帧扫描的20倍,但仅支持`dtd``bcs``otl`策略组。
8384

8485
## 常见问题
8586

8687
### 启用全屏字幕检测
8788

88-
`bcs`策略组默认仅检测屏幕底部四分之一区域,因为屏幕上方可能会有文字干扰字幕检测。如果你的视频字幕会高于下四分之一屏,请打开`config.yml`,在`bcs:``default:`部分找到`dialogRect:`参数,将`0.75`改为`0.00`
89-
90-
### 黑白灰字幕检测
91-
92-
如果你的视频的字幕是黑白灰的,`bcs`策略组可能会有比较多错漏。因为一般视频画面上的黑白灰面积通常比较大,会干扰检测,MagiaTimeline默认会降低纯灰度颜色的优先级,但这个特性可能反而会影响正常黑白灰字幕。如果你想关掉这个特性,请打开`config.yml`并找到`bcs:``default:`,找到`maxGreyscalePenalty: 0.70`并改成`0.00`
89+
`dtd``bcs`策略组默认仅检测屏幕底部四分之一区域,因为屏幕上方可能会有文字干扰字幕检测。如果你的视频字幕会高于下四分之一屏,请打开`config.yml`,在`dtd:`(或`bcs:`)-> `default:`部分找到`dialogRect:`参数,将`0.75`改为`0.00`
9390

9491
## 架构设计
9592

README.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Currently, only win_amd64 is supported. No Python installation is needed. You ca
3030

3131
#### Install from Source
3232

33-
1. Install [Python](https://www.python.org) 3.12.6 (or above, but < 3.13), 64-bit version.
33+
1. Install [Python](https://www.python.org) 3.12.8 (or above, but < 3.13), 64-bit version.
3434
2. Run `install.bat` (for Windows) or `install.sh` (for GNU/Linux or macOS). This automatically installs dependencies listed in `requirements.txt` into a Python virtual environment.
3535
3. *(For Extra Job `ocr` only, not required for basic timeline generation)* Install Tesseract OCR v5.3.3.20231005 (or above).
3636

@@ -41,7 +41,7 @@ Currently, only win_amd64 is supported. No Python installation is needed. You ca
4141
For beginners, the following settings are recommended:
4242

4343
- Specify the input video file in the `source` section.
44-
- Set `strategy` to `bcs` and `preset` to `default`. This should already be the default.
44+
- Set `strategy` to `dtd` and `preset` to `default`. This should already be the default.
4545
- Set `engine` to `speculative`. This should also be the default.
4646

4747
**Debug Running**: Run in debug mode to check whether the subtitle area is included in the detection window.
@@ -51,7 +51,7 @@ Temporarily make these changes to `config.yml`:
5151
- Set `engine` to `framewise`.
5252
- Under the `framewise` section, set `debug` to `true` (this is the default).
5353

54-
Then, run `MagiaTimeline.bat`/`MagiaTimeline.exe` (Windows) or `MagiaTimeline.sh` (GNU/Linux or macOS). A window will pop up showing the frames from your video with a red box at the bottom. The red box should cover the area where the subtitles appear. If it does not, adjust `dialogRect` under the `bcs`, `default` section and rerun. You don’t need to run the entire program in debug mode—quit by typing `q` in the display window whenever you’re done checking.
54+
Then, run `MagiaTimeline.bat`/`MagiaTimeline.exe` (Windows) or `MagiaTimeline.sh` (GNU/Linux or macOS). A window will pop up showing the frames from your video with a red box at the bottom. The red box should cover the area where the subtitles appear. If it does not, adjust `dialogRect` under the `dtd`, `default` section and rerun. You don’t need to run the entire program in debug mode—quit by typing `q` in the display window whenever you’re done checking.
5555

5656
If the video’s resolution is too high for the display window, consider adjusting `debugPyrDown` under the `framewise` section.
5757

@@ -63,9 +63,10 @@ If the video’s resolution is too high for the display window, consider adjusti
6363

6464
A *Strategy* is a set of CV algorithms that tells the framework how to identify subtitles in a frame. You can choose which Strategy to use for your video.
6565

66-
MagiaTimeline provides two recommended general-purpose Strategies:
66+
MagiaTimeline provides three recommended general-purpose Strategies:
6767

68-
- **Box colour stat (`bcs`)**: A CV pipeline consisting of ML-based text detection, color statistics, and feature extraction. This strategy works for most videos without tuning and is the top recommendation.
68+
- **Diff text detection (`dtd`)**: Finds text changes by performing ML-based text detection on the difference of two frames. This strategy works for most videos without tuning and is the top recommendation.
69+
- **Box colour stat (`bcs`)**: Performs colour statistics on regions boxed by ML-based text detection to find out text changes. This is a backup choice if `dtd` does not work.
6970
- **Outline (`otl`)**: A CV pipeline that relies on predefined parameters for text and outline color and weight to detect subtitles. It is much faster than `bcs` in applicable cases, but it requires manual parameter adjustments.
7071

7172
Traditionally, there are also Strategies specialized for certain types of videos. These are fast and accurate but not generalizable:
@@ -81,21 +82,15 @@ Traditionally, there are also Strategies specialized for certain types of videos
8182
An *Engine* determines how frames are sampled before they are processed by Strategies. MagiaTimeline provides two Engines:
8283

8384
- **Framewise**: Processes every frame (or every n-th frame, where n is configurable) to form a linear string of features before connecting them as subtitle intervals. This engine is slow but supports all Strategies. In debug mode, it provides a visual window showing the currently processed frame, useful for debugging and tuning parameters.
84-
- **Speculative**: Processes fewer frames by skipping those unlikely to contain subtitle changes. This engine is about 20× faster than the Framewise engine but only supports the `bcs` and `otl` general-purpose strategies.
85+
- **Speculative**: Processes fewer frames by skipping those unlikely to contain subtitle changes. This engine is about 20× faster than the Framewise engine but only supports the `dtd`, `bcs` and `otl` general-purpose strategies.
8586

8687
## Troubleshooting
8788

8889
### Enabling Entire-Frame Detection
8990

90-
By default, the `bcs` strategy only detects subtitles in the bottom quarter of the screen (`dialogRect` starts at `0.75`). This is because the upper part of the screen often contains text or other content that may interfere with subtitle detection.
91+
By default, the `dtd` and `bcs` strategies only detects subtitles in the bottom quarter of the screen (`dialogRect` starts at `0.75`). This is because the upper part of the screen often contains text or other content that may interfere with subtitle detection.
9192

92-
If your video has subtitles above this region and you need full-screen detection, open `config.yml`. Under the `bcs:``default:` section, locate the `dialogRect:` parameter and change the `0.75` to `0.00`. This allows subtitle detection across the entire frame.
93-
94-
### Black-and-White Subtitles
95-
96-
If your video features black-and-white (or gray) subtitles, you may find the `bcs` strategy difficult to detect them. MagiaTimeline assigns a lower priority to pure grayscale colors (black/white/gray), which helps reduce false positives but can interfere with accurately picking up purely black-and-white subtitles.
97-
98-
To improve black-and-white subtitle detection, open `config.yml` and go to `bcs:``default:`. Find `maxGreyscalePenalty: 0.70` and change it to `0.00`. This removes the penalty for grayscale pixels and may significantly improve the recognition of black-and-white subtitles.
93+
If your video has subtitles above this region and you need full-screen detection, open `config.yml`. Under the `dtd:` (or `bcs:`) -> `default:` section, locate the `dialogRect:` parameter and change the `0.75` to `0.00`. This allows subtitle detection across the entire frame.
9994

10095
## Architecture
10196

0 commit comments

Comments
 (0)