-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.yml
373 lines (337 loc) · 14.4 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# yaml-language-server: $schema=./ConfigSchema.json
# MagiaTimeline config
# This is the configuration file that defines the parameters required for the main program to run.
# In order for the program to work for your video, you should adjust the parameters here.
# The file is written in YAML format and constrained by JSON Schema in ConfigSchema.json.
# However, you do not need to be an expert of YAML or JSON Schema to modify this file.
# Any characters after a "#" in a line are comments that will be ignored by the program.
# There will be comments for entries below to help you understand and modify the parameters.
# If you are still not sure how to do it, just "do as Romans do": imitate existing defaults.
# Take it easy, the program will verify this file before running, so you are unlikely to
# harm the program with ill-formed parameters.
# Rectangles
# Any rectangle (or "rect") to be mentioned below defines a rectangular area in a frame.
# It is denoted in a tuple of four decimals from 0.0 to 1.0, [left, right, top, bottom].
# Each decimal represents a width or height in ratio to the whole frame.
# For example, [0.0, 1.0, 0.0, 1.0] represents the whole frame,
# and [0.50, 1.0, 0.0, 1.0] represents the right half of the frame.
# source: path(s) of source video files
# You may specify multiple source files for batching.
# They will be processed with the same settings.
source:
- src.mp4
# - src2.mp4
# destination: path(s) of destination subtitle files with no extension
# Include only the name of the file, without the extension,
# because they may also be used by extra jobs.
# There must be equal number of source(s) and destination(s).
destination:
- MagiaTimelineOutput
# - MagiaTimelineOutput2
# assTemplate: template ass file defining the header of destination ass file, in asst format
# The default template should work for most cases.
assTemplate: template.asst
# enableOpenCL: enable OpenCL acceleration
# If you have a graphics card or other accelerators, enabling this option may speed up the program.
# However, if you encounter problems or the program runs slower, you should disable this option.
enableOpenCL: false
# contentRect: defines the rectangle that wraps the content of a frame, cutting away black bars around
# If your video has black bars around the canvas, you should set this rectangle to cut them away.
# For example, if your video has 1% of black bar on left and right and 9% on top and bottom,
# then you should set this to [0.01, 0.99, 0.09, 0.91].
contentRect: [0.0, 1.0, 0.0, 1.0]
# Strategies and Presets
# MagiaTimeline supports different types of videos by providing sets of algorithms called Strategies.
# Each Strategy comes with a set of tunable parameters and several presets of them.
# You need to choose which Strategy and which preset of it to use.
# For general purpose, bcs is the recommended Strategy.
# It is likely to function for a variety of videos with default parameters.
# There are also other legacy strategies for specific types of videos.
# They are more accurate and efficient for their specific types of videos, but may not work for others.
# They also require more tuning of parameters to work properly.
# strategy: which algorithm set to use
# - mr: MagiaRecord quest video
# - mr-s0: MagiaRecord Scene0 film
# - lcb: LimbusCompany quest video
# - lcb-mech: LimbusCompany mechanics introduction video
# - pkm: PekemonEmerald quest video
# - prk: Parako anime conte
# - bdr: BanG Dream story video
# - otl: Outlined text
# - bcs: Box colour stat (general-purpose)
strategy: bcs
# preset: which preset of parameters under a strategy to use
preset: default
# MagiaRecord quest video
mr:
default:
dialogOutlineRect: [0.25, 0.75, 0.60, 0.95]
dialogBgRect: [0.3125, 0.6797, 0.7264, 0.8784]
blackscreenRect: [0.15, 0.85, 0.00, 1.00]
whitescreenRect: [0.15, 0.65, 0.00, 1.00]
cgSubAboveRect: [0.0, 1.0, 0.60, 0.65]
cgSubBorderRect: [0.0, 1.0, 0.65, 0.70]
cgSubBelowRect: [0.0, 1.0, 0.70, 0.75]
cgSubTextRect: [0.3, 0.7, 0.70, 1.00]
narrow:
dialogOutlineRect: [0.21, 0.79, 0.60, 0.97]
dialogBgRect: [0.27, 0.73, 0.75, 0.90]
blackscreenRect: [0.15, 0.85, 0.00, 1.00]
whitescreenRect: [0.15, 0.65, 0.00, 1.00]
cgSubAboveRect: [0.0, 1.0, 0.67, 0.72]
cgSubBorderRect: [0.0, 1.0, 0.72, 0.77]
cgSubBelowRect: [0.0, 1.0, 0.77, 0.82]
cgSubTextRect: [0.3, 0.7, 0.77, 1.00]
# You can create and use your own preset, as long as it conforms to the format of its strategy.
myownpreset:
dialogOutlineRect: [0.25, 0.75, 0.60, 0.95]
dialogBgRect: [0.3125, 0.6797, 0.7264, 0.8784]
blackscreenRect: [0.15, 0.85, 0.00, 1.00]
whitescreenRect: [0.15, 0.65, 0.00, 1.00]
cgSubAboveRect: [0.0, 1.0, 0.60, 0.65]
cgSubBorderRect: [0.0, 1.0, 0.65, 0.70]
cgSubBelowRect: [0.0, 1.0, 0.70, 0.75]
cgSubTextRect: [0.3, 0.7, 0.70, 1.00]
# MagiaRecord Scene0 film
mr-s0:
default:
dialogRect: [0.35, 0.65, 0.74, 0.93]
blackscreenRect: [0.15, 0.85, 0.00, 1.00]
narrow:
dialogRect: [0.32, 0.68, 0.76, 0.96]
blackscreenRect: [0.15, 0.85, 0.00, 1.00]
# LimbusCompany quest video
lcb:
default:
dialogRect: [0.18, 0.82, 0.79, 0.97]
# LimbusCompany mechanics introduction video
lcb-mech:
default:
dialogRect: [0.30, 0.70, 0.875, 0.915]
# PekemonEmerald quest video
pkm:
default:
dialogBgRect: [0.05, 0.95, 0.75, 0.95]
# Parako anime conte
prk:
default:
dialogRect: [0.00, 1.00, 0.86, 1.00]
vertical:
dialogRect: [0.00, 1.00, 0.57, 0.69]
# BanG Dream story video
bdr:
default:
dialogRect: [0.06, 0.94, 0.82, 0.96]
# Outlined text
otl:
yukkurirailways:
# dialogRect: rectangle of the detected dialog area
dialogRect: [0.00, 1.00, 0.75, 1.00]
# fastMode: fast mode skips boundary detection for speed but may reduce accuracy
fastMode: false
# textWeightMin: minimum weight for areas to be considered as text
textWeightMin: 3
# textWeightMax: maximum weight for areas to be considered as text
textWeightMax: 25
# textHSVRanges: HSV ranges for areas to be considered as text
# Each range is a list of six integers: [Hmin, Smin, Vmin, Hmax, Smax, Vmax]
textHSVRanges:
- [0, 0, 240, 180, 16, 255]
# outlineWeightMax: maximum weight for areas to be considered as outlines
outlineWeightMax: 15
# outlineHSVRanges: HSV ranges for areas to be considered as outlines
outlineHSVRanges:
- [0, 0, 0, 180, 255, 16]
# boundCompensation: extra width applied during the text-outline mutual filtering process
boundCompensation: 4
# sobelThreshold: threshold for the Sobel edge detection
sobelThreshold: 250
# nestingSuppression: suppression weight of the nested outline
# Sometimes there is an extra layer of outline that shares the text colour
# This parameter sets the weight to scrap from the text area
nestingSuppression: 0
# featureThreshold: minimum feature weight for a frame to be considered containing subtitles
featureThreshold: 1.0
# featureJumpThreshold: maximum feature difference between frames to be considered as a jump
featureJumpThreshold: 0.1
# featureJumpStddevThreshold: maximum standard deviation of feature difference between frames to be considered the same
featureJumpStddevThreshold: 0.005
# debugLevel: setting it to 1-3 will show different intermediate step images to the debug window
debugLevel: 0
yukkurilocaltrain:
dialogRect: [0.00, 1.00, 0.75, 1.00]
fastMode: false
textWeightMin: 5
textWeightMax: 25
textHSVRanges:
- [0, 200, 128, 30, 255, 255]
- [170, 200, 128, 180, 255, 255]
- [105, 100, 128, 135, 255, 255]
outlineWeightMax: 5
outlineHSVRanges:
- [0, 0, 180, 180, 64, 255]
boundCompensation: 4
sobelThreshold: 192
nestingSuppression: 9
featureThreshold: 1.0
featureJumpThreshold: 0.1
featureJumpStddevThreshold: 0.005
debugLevel: 0
japantrafficlab:
dialogRect: [0.00, 1.00, 0.75, 1.00]
fastMode: false
textWeightMin: 1
textWeightMax: 19
textHSVRanges:
- [70, 180, 180, 100, 255, 255]
outlineWeightMax: 15
outlineHSVRanges:
- [95, 180, 180, 140, 255, 255]
boundCompensation: 4
sobelThreshold: 100
nestingSuppression: 0
featureThreshold: 1.0
featureJumpThreshold: 0.1
featureJumpStddevThreshold: 0.005
debugLevel: 0
yorumeron-yukari:
dialogRect: [0.00, 1.00, 0.80, 1.00]
fastMode: false
textWeightMin: 1
textWeightMax: 15
textHSVRanges:
- [135, 0, 220, 155, 60, 255]
outlineWeightMax: 9
outlineHSVRanges:
- [0, 0, 0, 180, 255, 25]
boundCompensation: 2
sobelThreshold: 192
nestingSuppression: 0
featureThreshold: 1.0
featureJumpThreshold: 0.1
featureJumpStddevThreshold: 0.005
debugLevel: 0
hotelzdm:
dialogRect: [0.00, 1.00, 0.75, 1.00]
fastMode: false
textWeightMin: 5
textWeightMax: 25
textHSVRanges:
- [0, 200, 100, 10, 255, 180]
- [170, 200, 100, 180, 255, 180]
- [25, 100, 100, 55, 200, 200]
outlineWeightMax: 7
outlineHSVRanges:
- [0, 0, 200, 180, 32, 255]
boundCompensation: 2
sobelThreshold: 200
nestingSuppression: 5
featureThreshold: 1.0
featureJumpThreshold: 0.1
featureJumpStddevThreshold: 0.005
debugLevel: 0
zundahouse:
dialogRect: [0.00, 1.00, 0.75, 1.00]
fastMode: false
textWeightMin: 1
textWeightMax: 25
textHSVRanges:
- [155, 100, 200, 180, 200, 255]
- [55, 150, 150, 75, 220, 220]
outlineWeightMax: 15
outlineHSVRanges:
- [0, 0, 240, 180, 64, 255]
boundCompensation: 4
sobelThreshold: 230
nestingSuppression: 23
featureThreshold: 1.0
featureJumpThreshold: 0.1
featureJumpStddevThreshold: 0.005
debugLevel: 0
# Box colour stat (general-purpose)
bcs:
default:
# dialogRect: rectangle of the detected dialog area
dialogRect: [0.00, 1.00, 0.75, 1.00]
# sobelThreshold: threshold for the Sobel edge detection
sobelThreshold: 32
# featureThreshold: minimum feature weight for a frame to be considered containing subtitles
featureThreshold: 0.3
# featureJumpThreshold: maximum feature difference between frames to be considered as a jump
featureJumpThreshold: 0.1
# featureJumpStddevThreshold: maximum standard deviation of feature difference between frames to be considered the same
featureJumpStddevThreshold: 0.005
# boxVerticalExpansion: vertical expansion ratio of the detected dialog box
boxVerticalExpansion: 0.05
# nonMajorBoxSuppressionMaxRatio: boxes with a ratio (over all boxes) lower than this will be suppressed
nonMajorBoxSuppressionMaxRatio: 0.2
# nonMajorBoxSuppressionMinRank: but at least this number of boxes will be kept
nonMajorBoxSuppressionMinRank: 1
# minCcAreaRatio: minimum ratio (over all connected components) to be considered text area candidate
minCcAreaRatio: 0.0
# maxCcAreaRatio: maximum ratio (over all connected components) to be considered text area candidate
maxCcAreaRatio: 0.3
# minCcFinalMean: minimum mean of connected component colour for a frame to be considered containing subtitles
minCcFinalMean: 3.0
# maxCcStddev: maximum standard deviation for a connected component to be considered consistent enough to be text
maxCcStddev: 10
# colourTolerance: distance from the selected mean colour to be filtered for text
colourTolerance: 30
# clusterThreshold: maximum distance threshold for hierarchical clustering
clusterThreshold: 1
# minColourAreaRatio: minimum ratio (over all connected components) to be further considered text area candidate
minColourAreaRatio: 0.01
# maxGreyscalePenalty: a colour that is right on the greyscale axis will be penalized by this factor for its tendency to be selected
maxGreyscalePenalty: 0.70
# iirPassDenoiseMinTime: minimum time (in milliseconds) for an interval to be kept
iirPassDenoiseMinTime: 300
# debugLevel: setting it to 1 will show the binary image of the text area
debugLevel: 0
# Engines
# Engines decide how frames are sampled before they are processed by Strategies.
# This affects the performance and accuracy of the program.
# A given Strategy must implement a given Engine's required methods to work with it.
# Not all Engines are compatible with all Strategies.
# By default, all Strategies are compatible with the Framewise Engine.
# Currently, bcs and otl also support the Specilative Engine for faster processing.
# Each Engine has its own parameters that can be adjusted.
# engine: which frame sampling pipeline to use
# - framewise: samples every frame or every n-th frame
# - speculative: skips frames where subtitles do not change and performs binary search for change points
engine: speculative
framewise:
# sampleInterval: in how many frames to sample a frame
# If you have a high-resolution or high-fps video, you can increase this number to speed up the program.
# However, this will reduce the accuracy of the subtitles.
sampleInterval: 1
# debug: whether to show debug information
# Framewise Engine's debug mode will show a window displaying the processed frames with rectangles and FPIR parameters.
# Some Strategies may also show intermediate steps in the debug window.
# Tap q to quit the debug window. The x button may not work.
debug: true
# debugPyrDown: how many times to downscale the debug window
# If the video's resolution is too high, the debug window may be too large to fit on the screen.
# You can downscale the debug window by this number to fit it on the screen.
debugPyrDown: 0
speculative:
# emptyGapForceCheck: in how many milliseconds to force check for existence of subtitles
# If two frames were sampled where none of them had subtitles,
# the program will force check the existence of subtitles in this number of milliseconds,
# instead of considering there are no subtitles in the gap.
# If this is set to 0, the program will not force check.
emptyGapForceCheck: 1000
# debug: whether to show debug information
# Speculative Engine's debug mode will print its decision of inserting/extending intervals after each frame.
debug: false
# Extra Jobs
# Extra jobs are additional tasks that can be performed after the subtitles are extracted.
# Currently, the program supports only one experimental extra job: OCR.
# extraJobs: list of extra jobs to perform after subtitle extraction
extraJobs: []
ocr:
suffix: "-ocr.txt"
separator: "@"
doPaddle: true
paddleLang: "japan"
doTesseract: true
tesseractLang: "jpn"