Skip to content

Commit 95958fe

Browse files
committed
Improvements
Auto Sub ReTimer General Fixes for all scripts: - Now there is no need to rename the video to "ep.mkv", the ".mkv" extension will be read directly, regardless of the name. - OnTop lines will now be processed from Auto Sub Retimer (but not all). Fase0: - Improved tag detection for .srt and .ass files. - Previously, OnTop lines (positioned at the top of the screen) that did NOT overlap would still go to "OnTop.ass/srt" without being processed to improve timing. Now, they will remain in "Dialogues" for processing. Lines with temporal overlap will remain in "OnTop" as before. (If by chance the ontop line is a sign and is not placed in "Sings" because it has few tags, its timing may be adjusted.) - Dialog lines that overlap in time with another dialog line (which are not OnTop, tag or syles) are now also handled. If there is an overlap, the line that creates the overlap will be put on OnTop.ass/srt (temporally or chronologically, depending on the situation) because it cannot be handled by Auto Sub ReTimer.
1 parent 7aac4ea commit 95958fe

File tree

15 files changed

+281
-88
lines changed

15 files changed

+281
-88
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Tip: If you're unsure about your CUDA version, open a terminal (cmd) and type "n
1616

1717
- Save and you're done!
1818

19-
- Put your episode renamed to "ep.mkv" inside the "Auto Sub ReTimer" folder.
19+
- Put your video .mkv inside the "Auto Sub ReTimer" folder.
2020

2121
Example:
2222

@@ -76,7 +76,7 @@ To use whisper.
7676

7777
REQUIREMENTS
7878

79-
- Put your episode renamed to "ep.mkv" inside the "Auto Sub ReTimer" folder.
79+
- Put your video .mkv inside the "Auto Sub ReTimer" folder.
8080

8181
- Run "Auto Sub ReTimer GUI.bat" and use "Whisper".
8282

Scripts/GUI/GUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ def seleziona_funzione(funzione):
10811081
if paths['available']['autosub']:
10821082
instructions_text.insert("1.0",
10831083
"Auto Sub ReTimer\n\n"
1084-
"1. Make sure you have the episode renamed to ep.mkv in the Auto Sub ReTimer folder.\n"
1084+
"1. Make sure you have the video .mkv in the Auto Sub ReTimer folder.\n"
10851085
"\n"
10861086
"2. The line of spoken audio in the sub must be within the lines and not partially outside the line (audio spectrum).\n"
10871087
"There must not be the start of spoken audio that begins before the line, for example.\n"
@@ -1109,7 +1109,7 @@ def seleziona_funzione(funzione):
11091109
"Whisper\n\n"
11101110
"Automatic audio transcription:\n"
11111111
"\n"
1112-
"1. Make sure you have the episode renamed to ep.mkv in the Auto Sub ReTimer folder.\n"
1112+
"1. Make sure you have the video .mkv in the Auto Sub ReTimer folder.\n"
11131113
"\n"
11141114
"2. Faster-Whisper execution.\n"
11151115
"\n"

Scripts/Migliora il Timing Dei Sub/Config_Fase2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"picco_audio_threshold": 500,
33
"max_range_picco": 700,
44
"lead_in": 175,
5-
"lead_out": 420
5+
"lead_out": 410
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"max_range_next_scene": 300,
33
"gap_threshold": 280,
4-
"scene_change_before_threshold": 250,
4+
"scene_change_before_threshold": 240,
55
"scene_change_after_threshold": 200
66
}

Scripts/Migliora il Timing Dei Sub/Fase0.py

Lines changed: 215 additions & 46 deletions
Large diffs are not rendered by default.

Scripts/Migliora il Timing Dei Sub/Fase1.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
# Percorso relativo al progetto
77
project_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
88

9-
# Nome del file MKV di input
10-
input_file = "ep.mkv"
9+
# MKV di input
10+
mkv_files = [f for f in os.listdir(project_path) if f.endswith('.mkv')]
11+
if not mkv_files:
12+
print(f"Errore: Nessun file .mkv trovato nella directory '{project_path}'.")
13+
exit()
14+
input_file = mkv_files[0]
1115

1216
# Directory di input/output basata su project_path
1317
input_path = os.path.join(project_path, input_file)

Scripts/Migliora il Timing Dei Sub/Fase3.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ def process_segment(args):
139139
return []
140140

141141
def main():
142-
# Percorso del file video
143-
video_path = os.path.join(project_path, "ep.mkv")
144-
if not os.path.exists(video_path):
145-
raise FileNotFoundError("Il file video non è stato trovato.")
142+
# MKV
143+
mkv_files = [f for f in os.listdir(project_path) if f.endswith('.mkv')]
144+
if not mkv_files:
145+
raise FileNotFoundError("Nessun file .mkv trovato nella directory.")
146+
video_path = os.path.join(project_path, mkv_files[0])
147+
print(f"Trovato video: {mkv_files[0]}")
146148

147149
# Percorso del file SRT dei sottotitoli
148150
srt_path = os.path.join(project_path, "adjusted_Sub.srt")

Scripts/Migliora il Timing Dei Sub/Fase6.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,19 @@ def verifica_file(files, base_path):
299299
"On Top.srt"
300300
]
301301

302+
# MKV
303+
mkv_files = [f for f in os.listdir(project_path) if f.endswith('.mkv')]
304+
if not mkv_files:
305+
raise FileNotFoundError("Nessun file .mkv trovato nella directory.")
306+
mkv_filename = mkv_files[0]
307+
302308
files_to_move_option_1 = [
303-
"ep.mkv",
309+
mkv_filename,
304310
"Final.ass"
305311
]
306312

307313
files_to_move_option_2 = [
308-
"ep.mkv",
314+
mkv_filename,
309315
"Final.srt"
310316
]
311317

@@ -318,7 +324,7 @@ def verifica_file(files, base_path):
318324
sposta_file(files_to_move_option_1, project_path, desktop_path)
319325
elimina_file(files_to_delete_option_1, project_path)
320326
else:
321-
files_to_move = ["ep.mkv", "Final.ass"]
327+
files_to_move = [mkv_filename, "Final.ass"]
322328
for file in ["On Top.ass", "Comments.ass", "Signs.ass"]:
323329
file_path = os.path.join(project_path, file)
324330
if not is_file_empty(file_path):
@@ -338,7 +344,7 @@ def verifica_file(files, base_path):
338344
sposta_file(files_to_move_option_2, project_path, desktop_path)
339345
elimina_file(files_to_delete_option_2, project_path)
340346
else:
341-
files_to_move = ["ep.mkv", "Final.srt"]
347+
files_to_move = [mkv_filename, "Final.srt"]
342348
on_top_path = os.path.join(project_path, "On Top.srt")
343349
if not is_file_empty(on_top_path):
344350
files_to_move.append("On Top.srt")

Scripts/Migliora il Timing Dei Sub/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Separate from uploaded .srt sub:
1616
Values you can modify: None.
1717

1818
Fase1.py:
19-
- Extracts audio from "ep.mkv", passes it to demucs which extracts vocals with the CPU (3/5 minutes) or with GPU (30/40 seconds).
19+
- Extracts audio from the video .mkv, passes it to demucs which extracts vocals with the CPU (3/5 minutes) or with GPU (30/40 seconds).
2020
- Now there is no need to use the site anymore, it does everything automatically locally, make sure you have the right cuda version installed for you in the "main" folder to use GPU.
2121

2222
Values you can modify: None.

Scripts/Migliora il Timing Dei Sub/Test Snapping like Aegisub/Fase3.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ def process_segment(args):
139139
return []
140140

141141
def main():
142-
# Percorso del file video
143-
video_path = os.path.join(project_path, "ep.mkv")
144-
if not os.path.exists(video_path):
145-
raise FileNotFoundError("Il file video non è stato trovato.")
142+
# MKV
143+
mkv_files = [f for f in os.listdir(project_path) if f.endswith('.mkv')]
144+
if not mkv_files:
145+
raise FileNotFoundError("Nessun file .mkv trovato nella directory.")
146+
video_path = os.path.join(project_path, mkv_files[0])
147+
print(f"Trovato video: {mkv_files[0]}")
146148

147149
# Percorso del file SRT dei sottotitoli
148150
srt_path = os.path.join(project_path, "adjusted_Sub.srt")

0 commit comments

Comments
 (0)