Spaces:
Sleeping
Sleeping
Eason Lu
commited on
Commit
•
04ae3b4
1
Parent(s):
ae0ed1b
replace whisper api to whisper lib
Browse filesFormer-commit-id: 8d281f157b6c35b25f6104afeb3159e238ac5197
- __pycache__/srt2ass.cpython-310.pyc +0 -0
- pipeline.py +44 -26
- srt2ass.py +298 -0
__pycache__/srt2ass.cpython-310.pyc
ADDED
Binary file (13.9 kB). View file
|
|
pipeline.py
CHANGED
@@ -3,26 +3,27 @@ from pytube import YouTube
|
|
3 |
import argparse
|
4 |
import os
|
5 |
import io
|
6 |
-
|
7 |
-
|
8 |
|
9 |
parser = argparse.ArgumentParser()
|
10 |
parser.add_argument("--link", help="youtube video link here", default=None, type=str, required=False)
|
11 |
parser.add_argument("--local_path", help="local video path here", default=None, type=str, required=False)
|
12 |
-
parser.add_argument("--
|
13 |
parser.add_argument("--download", help="download path", default='./downloads', type=str, required=False)
|
14 |
-
parser.add_argument("--
|
15 |
parser.add_argument("--video_name", help="video name", default='placeholder', type=str, required=False)
|
16 |
-
parser.add_argument("--model_name", help="model name only support text-davinci-003 and gpt-3.5-turbo",
|
17 |
args = parser.parse_args()
|
18 |
|
19 |
-
|
20 |
-
|
|
|
21 |
exit()
|
22 |
|
23 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
24 |
DOWNLOAD_PATH = args.download
|
25 |
-
RESULT_PATH = args.
|
26 |
VIDEO_NAME = args.video_name
|
27 |
n_threshold = 1000 # Token limit for the GPT-3.5 model
|
28 |
# model_name = "text-davinci-003" # replace this to our own fintune model
|
@@ -41,32 +42,47 @@ if args.link is not None and args.local_path is None:
|
|
41 |
except Exception as e:
|
42 |
print("Connection Error")
|
43 |
print(e)
|
44 |
-
|
|
|
45 |
VIDEO_NAME = audio.default_filename.split('.')[0]
|
46 |
elif args.local_path is not None:
|
47 |
# Read from local
|
48 |
audio_file= open(args.local_path, "rb")
|
49 |
-
|
50 |
|
51 |
|
52 |
# Instead of using the script_en variable directly, we'll use script_input
|
53 |
-
|
54 |
-
|
|
|
55 |
script_input = f.read()
|
56 |
else:
|
57 |
-
# perform speech-to-text and save it in <video name>_en.txt under RESULT PATH.
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
# split the video script(open ai prompt limit: about 5000)
|
64 |
-
with open(
|
65 |
script_en = f.read()
|
66 |
-
# N = len(script_en)
|
67 |
-
# script_split = script_en.split('.')
|
68 |
script_input = script_en
|
69 |
|
|
|
|
|
|
|
|
|
70 |
# Split the video script by sentences and create chunks within the token limit
|
71 |
n_threshold = 4096 # Token limit for the GPT-3 model
|
72 |
script_split = script_input.split('.')
|
@@ -86,7 +102,7 @@ if script.strip():
|
|
86 |
for s in script_arr:
|
87 |
# using chatgpt model
|
88 |
if model_name == "gpt-3.5-turbo":
|
89 |
-
print(s + "\n")
|
90 |
response = openai.ChatCompletion.create(
|
91 |
model=model_name,
|
92 |
messages = [
|
@@ -95,12 +111,12 @@ for s in script_arr:
|
|
95 |
],
|
96 |
temperature=0.1
|
97 |
)
|
98 |
-
with open(f"{RESULT_PATH}/{VIDEO_NAME}_zh.
|
99 |
f.write(response['choices'][0]['message']['content'].strip())
|
100 |
-
|
101 |
if model_name == "text-davinci-003":
|
102 |
prompt = f"Please help me translate this into Chinese:\n\n{s}\n\n"
|
103 |
-
print(prompt)
|
104 |
response = openai.Completion.create(
|
105 |
model=model_name,
|
106 |
prompt=prompt,
|
@@ -111,6 +127,8 @@ for s in script_arr:
|
|
111 |
presence_penalty=0.0
|
112 |
)
|
113 |
|
114 |
-
with open(f"{RESULT_PATH}/{VIDEO_NAME}_zh.
|
115 |
f.write(response['choices'][0]['text'].strip())
|
116 |
-
|
|
|
|
|
|
3 |
import argparse
|
4 |
import os
|
5 |
import io
|
6 |
+
import whisper
|
7 |
+
import ffmpeg
|
8 |
|
9 |
parser = argparse.ArgumentParser()
|
10 |
parser.add_argument("--link", help="youtube video link here", default=None, type=str, required=False)
|
11 |
parser.add_argument("--local_path", help="local video path here", default=None, type=str, required=False)
|
12 |
+
parser.add_argument("--srt_file", help="srt file input path here", default=None, type=str, required=False) # New argument
|
13 |
parser.add_argument("--download", help="download path", default='./downloads', type=str, required=False)
|
14 |
+
parser.add_argument("--output_dir", help="translate result path", default='./results', type=str, required=False)
|
15 |
parser.add_argument("--video_name", help="video name", default='placeholder', type=str, required=False)
|
16 |
+
parser.add_argument("--model_name", help="model name only support text-davinci-003 and gpt-3.5-turbo", type=str, required=False, default="gpt-3.5-turbo")
|
17 |
args = parser.parse_args()
|
18 |
|
19 |
+
# input should be either video file or youtube video link.
|
20 |
+
if args.link is None and args.local_path is None and args.srt_file is None:
|
21 |
+
print("need video source or srt file")
|
22 |
exit()
|
23 |
|
24 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
25 |
DOWNLOAD_PATH = args.download
|
26 |
+
RESULT_PATH = args.output_dir
|
27 |
VIDEO_NAME = args.video_name
|
28 |
n_threshold = 1000 # Token limit for the GPT-3.5 model
|
29 |
# model_name = "text-davinci-003" # replace this to our own fintune model
|
|
|
42 |
except Exception as e:
|
43 |
print("Connection Error")
|
44 |
print(e)
|
45 |
+
audio_path = '{}/{}'.format(DOWNLOAD_PATH, audio.default_filename)
|
46 |
+
audio_file = open(audio_path, "rb")
|
47 |
VIDEO_NAME = audio.default_filename.split('.')[0]
|
48 |
elif args.local_path is not None:
|
49 |
# Read from local
|
50 |
audio_file= open(args.local_path, "rb")
|
51 |
+
audio_path = args.local_path
|
52 |
|
53 |
|
54 |
# Instead of using the script_en variable directly, we'll use script_input
|
55 |
+
srt_file_en = args.srt_file
|
56 |
+
if srt_file_en is not None:
|
57 |
+
with open(srt_file_en, 'r') as f:
|
58 |
script_input = f.read()
|
59 |
else:
|
60 |
+
# using whisper to perform speech-to-text and save it in <video name>_en.txt under RESULT PATH.
|
61 |
+
srt_file_en = "{}/{}_en.srt".format(RESULT_PATH, VIDEO_NAME)
|
62 |
+
if not os.path.exists(srt_file_en):
|
63 |
+
# use OpenAI API for transcribe
|
64 |
+
# transcript = openai.Audio.transcribe("whisper-1", audio_file)
|
65 |
+
|
66 |
+
# use local whisper model
|
67 |
+
model = whisper.load_model("base") # using base model in local machine (may use large model on our server)
|
68 |
+
transcript = model.transcribe(audio_path)
|
69 |
+
|
70 |
+
#Write SRT file
|
71 |
+
from whisper.utils import WriteSRT
|
72 |
+
|
73 |
+
with open(srt_file_en, 'w', encoding="utf-8") as srt:
|
74 |
+
writer = WriteSRT(RESULT_PATH)
|
75 |
+
writer.write_result(transcript, srt)
|
76 |
|
77 |
# split the video script(open ai prompt limit: about 5000)
|
78 |
+
with open(srt_file_en, 'r') as f:
|
79 |
script_en = f.read()
|
|
|
|
|
80 |
script_input = script_en
|
81 |
|
82 |
+
from srt2ass import srt2ass
|
83 |
+
assSub_en = srt2ass(srt_file_en, "default", "No", "Modest")
|
84 |
+
print('ASS subtitle saved as: ' + assSub_en)
|
85 |
+
|
86 |
# Split the video script by sentences and create chunks within the token limit
|
87 |
n_threshold = 4096 # Token limit for the GPT-3 model
|
88 |
script_split = script_input.split('.')
|
|
|
102 |
for s in script_arr:
|
103 |
# using chatgpt model
|
104 |
if model_name == "gpt-3.5-turbo":
|
105 |
+
# print(s + "\n")
|
106 |
response = openai.ChatCompletion.create(
|
107 |
model=model_name,
|
108 |
messages = [
|
|
|
111 |
],
|
112 |
temperature=0.1
|
113 |
)
|
114 |
+
with open(f"{RESULT_PATH}/{VIDEO_NAME}_zh.srt", 'a+') as f:
|
115 |
f.write(response['choices'][0]['message']['content'].strip())
|
116 |
+
|
117 |
if model_name == "text-davinci-003":
|
118 |
prompt = f"Please help me translate this into Chinese:\n\n{s}\n\n"
|
119 |
+
# print(prompt)
|
120 |
response = openai.Completion.create(
|
121 |
model=model_name,
|
122 |
prompt=prompt,
|
|
|
127 |
presence_penalty=0.0
|
128 |
)
|
129 |
|
130 |
+
with open(f"{RESULT_PATH}/{VIDEO_NAME}_zh.srt", 'a+') as f:
|
131 |
f.write(response['choices'][0]['text'].strip())
|
132 |
+
|
133 |
+
assSub_zh = srt2ass(f"{RESULT_PATH}/{VIDEO_NAME}_zh.srt", "default", "No", "Modest")
|
134 |
+
print('ASS subtitle saved as: ' + assSub_zh)
|
srt2ass.py
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
#
|
3 |
+
# python-srt2ass: https://github.com/ewwink/python-srt2ass
|
4 |
+
# by: ewwink
|
5 |
+
# modified by: 一堂宁宁 Lenshyuu227
|
6 |
+
|
7 |
+
# original srt2ass: https://github.com/Ayanaminn/N46Whisper/blob/main/srt2ass.py
|
8 |
+
# modified by: Myth
|
9 |
+
|
10 |
+
import sys
|
11 |
+
import os
|
12 |
+
import regex as re
|
13 |
+
import codecs
|
14 |
+
|
15 |
+
|
16 |
+
def fileopen(input_file):
|
17 |
+
# use correct codec to encode the input file
|
18 |
+
encodings = ["utf-32", "utf-16", "utf-8", "cp1252", "gb2312", "gbk", "big5"]
|
19 |
+
srt_src = ''
|
20 |
+
for enc in encodings:
|
21 |
+
try:
|
22 |
+
with codecs.open(input_file, mode="r", encoding=enc) as fd:
|
23 |
+
# return an instance of StreamReaderWriter
|
24 |
+
srt_src = fd.read()
|
25 |
+
break
|
26 |
+
except:
|
27 |
+
# print enc + ' failed'
|
28 |
+
continue
|
29 |
+
return [srt_src, enc]
|
30 |
+
|
31 |
+
|
32 |
+
def srt2ass(input_file,sub_style, is_split, split_method):
|
33 |
+
if '.ass' in input_file:
|
34 |
+
return input_file
|
35 |
+
|
36 |
+
if not os.path.isfile(input_file):
|
37 |
+
print(input_file + ' not exist')
|
38 |
+
return
|
39 |
+
|
40 |
+
src = fileopen(input_file)
|
41 |
+
srt_content = src[0]
|
42 |
+
# encoding = src[1] # Will not encode so do not need to pass codec para
|
43 |
+
src = ''
|
44 |
+
utf8bom = ''
|
45 |
+
|
46 |
+
if u'\ufeff' in srt_content:
|
47 |
+
srt_content = srt_content.replace(u'\ufeff', '')
|
48 |
+
utf8bom = u'\ufeff'
|
49 |
+
|
50 |
+
srt_content = srt_content.replace("\r", "")
|
51 |
+
lines = [x.strip() for x in srt_content.split("\n") if x.strip()]
|
52 |
+
subLines = ''
|
53 |
+
dlgLines = '' # dialogue line
|
54 |
+
lineCount = 0
|
55 |
+
output_file = '.'.join(input_file.split('.')[:-1])
|
56 |
+
output_file += '.ass'
|
57 |
+
|
58 |
+
for ln in range(len(lines)):
|
59 |
+
line = lines[ln]
|
60 |
+
if line.isdigit() and re.match('-?\d\d:\d\d:\d\d', lines[(ln+1)]):
|
61 |
+
if dlgLines:
|
62 |
+
subLines += dlgLines + "\n"
|
63 |
+
dlgLines = ''
|
64 |
+
lineCount = 0
|
65 |
+
continue
|
66 |
+
else:
|
67 |
+
if re.match('-?\d\d:\d\d:\d\d', line):
|
68 |
+
line = line.replace('-0', '0')
|
69 |
+
if sub_style =='default':
|
70 |
+
dlgLines += 'Dialogue: 0,' + line + ',default,,0,0,0,,'
|
71 |
+
elif sub_style =='ikedaCN':
|
72 |
+
dlgLines += 'Dialogue: 0,' + line + ',池田字幕1080p,,0,0,0,,'
|
73 |
+
elif sub_style == 'sugawaraCN':
|
74 |
+
dlgLines += 'Dialogue: 0,' + line + ',中字 1080P,,0,0,0,,'
|
75 |
+
elif sub_style == 'kaedeCN':
|
76 |
+
dlgLines += 'Dialogue: 0,' + line + ',den SR红色,,0,0,0,,'
|
77 |
+
elif sub_style == 'taniguchiCN':
|
78 |
+
dlgLines += 'Dialogue: 0,' + line + ',正文_1080P,,0,0,0,,'
|
79 |
+
elif sub_style == 'asukaCN':
|
80 |
+
dlgLines += 'Dialogue: 0,' + line + ',DEFAULT1,,0,0,0,,'
|
81 |
+
else:
|
82 |
+
if lineCount < 2:
|
83 |
+
dlg_string = line
|
84 |
+
if is_split == "Yes" and split_method == 'Modest':
|
85 |
+
# do not split if space proceed and followed by non-ASC-II characters
|
86 |
+
# do not split if space followed by word that less than 5 characters
|
87 |
+
split_string = re.sub(r'(?<=[^\x00-\x7F])\s+(?=[^\x00-\x7F])(?=\w{5})', r'|', dlg_string)
|
88 |
+
# print(split_string)
|
89 |
+
if len(split_string.split('|')) > 1:
|
90 |
+
dlgLines += (split_string.replace('|', "(adjust_required)\n" + dlgLines)) + "(adjust_required)"
|
91 |
+
else:
|
92 |
+
dlgLines += line
|
93 |
+
elif is_split == "Yes" and split_method == 'Aggressive':
|
94 |
+
# do not split if space proceed and followed by non-ASC-II characters
|
95 |
+
# split at all the rest spaces
|
96 |
+
split_string = re.sub(r'(?<=[^\x00-\x7F])\s+(?=[^\x00-\x7F])', r'|', dlg_string)
|
97 |
+
if len(split_string.split('|')) > 1:
|
98 |
+
dlgLines += (split_string.replace('|',"(adjust_required)\n" + dlgLines)) + "(adjust_required)"
|
99 |
+
else:
|
100 |
+
dlgLines += line
|
101 |
+
else:
|
102 |
+
dlgLines += line
|
103 |
+
else:
|
104 |
+
dlgLines += "\n" + line
|
105 |
+
lineCount += 1
|
106 |
+
ln += 1
|
107 |
+
|
108 |
+
|
109 |
+
subLines += dlgLines + "\n"
|
110 |
+
|
111 |
+
subLines = re.sub(r'\d(\d:\d{2}:\d{2}),(\d{2})\d', '\\1.\\2', subLines)
|
112 |
+
subLines = re.sub(r'\s+-->\s+', ',', subLines)
|
113 |
+
# replace style
|
114 |
+
# subLines = re.sub(r'<([ubi])>', "{\\\\\g<1>1}", subLines)
|
115 |
+
# subLines = re.sub(r'</([ubi])>', "{\\\\\g<1>0}", subLines)
|
116 |
+
# subLines = re.sub(r'<font\s+color="?#(\w{2})(\w{2})(\w{2})"?>', "{\\\\c&H\\3\\2\\1&}", subLines)
|
117 |
+
# subLines = re.sub(r'</font>', "", subLines)
|
118 |
+
|
119 |
+
if sub_style == 'default':
|
120 |
+
head_name = 'head_str_default'
|
121 |
+
elif sub_style == 'ikedaCN':
|
122 |
+
head_name = 'head_str_ikeda'
|
123 |
+
elif sub_style == 'sugawaraCN':
|
124 |
+
head_name = 'head_str_sugawara'
|
125 |
+
elif sub_style == 'kaedeCN':
|
126 |
+
head_name = 'head_str_kaede'
|
127 |
+
elif sub_style == "taniguchiCN":
|
128 |
+
head_name = 'head_str_taniguchi'
|
129 |
+
elif sub_style == 'asukaCN':
|
130 |
+
head_name = 'head_str_asuka'
|
131 |
+
|
132 |
+
head_str = STYLE_DICT.get(head_name)
|
133 |
+
output_str = utf8bom + head_str + '\n' + subLines
|
134 |
+
# encode again for head string
|
135 |
+
output_str = output_str.encode('utf8')
|
136 |
+
|
137 |
+
with open(output_file, 'wb') as output:
|
138 |
+
output.write(output_str)
|
139 |
+
|
140 |
+
output_file = output_file.replace('\\', '\\\\')
|
141 |
+
output_file = output_file.replace('/', '//')
|
142 |
+
return output_file
|
143 |
+
|
144 |
+
|
145 |
+
# if len(sys.argv) > 1:
|
146 |
+
# for name in sys.argv[1:]:
|
147 |
+
# srt2ass(name,sub_style=)
|
148 |
+
|
149 |
+
|
150 |
+
STYLE_DICT = {
|
151 |
+
'head_str_default':'''[Script Info]
|
152 |
+
; This is an Advanced Sub Station Alpha v4+ script.
|
153 |
+
; The script is generated by N46Whisper
|
154 |
+
Title:
|
155 |
+
ScriptType: v4.00+
|
156 |
+
Collisions: Normal
|
157 |
+
PlayDepth: 0
|
158 |
+
|
159 |
+
[V4+ Styles]
|
160 |
+
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
161 |
+
Style: default,Meiryo,90,&H00FFFFFF,&H00FFFFFF,&H00000000,&H00050506,-1,0,0,0,100,100,5,0,1,3.5,0,2,135,135,10,1
|
162 |
+
[Events]
|
163 |
+
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text''',
|
164 |
+
'head_str_ikeda': '''[Script Info]
|
165 |
+
; This is an Advanced Sub Station Alpha v4+ script.
|
166 |
+
; The script is generated by N46Whisper
|
167 |
+
Title:
|
168 |
+
ScriptType: v4.00+
|
169 |
+
Collisions: Normal
|
170 |
+
PlayDepth: 0
|
171 |
+
|
172 |
+
[V4+ Styles]
|
173 |
+
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
174 |
+
Style: SubStyle,Arial,20,&H0300FFFF,&H00FFFFFF,&H00000000,&H02000000,-1,0,0,0,100,100,0,0,3,2,0,2,10,10,10,1
|
175 |
+
Style: 池田字幕1080p,思源黑体,71,&H00FFFFFF,&H000000FF,&H00008A11,&H00000000,-1,0,0,0,100,100,1.49999,0,1,1.99999,1,2,8,8,5,1
|
176 |
+
Style: 池田字幕1080p - 不透明背景,思源黑体,71,&H00FFFFFF,&H000000FF,&H64202021,&H00000000,-1,0,0,0,100,100,1.49999,0,3,1.99999,0,2,8,8,5,1
|
177 |
+
Style: staff1080p,思源黑体,55,&H00FFFFFF,&H00FFFFFF,&H34000000,&H00000000,-1,0,0,0,100,100,3,0,1,2.5,0,7,16,13,4,1
|
178 |
+
Style: 注释1080p,思源宋体 CN,55,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,1,8,10,10,10,1
|
179 |
+
Style: 多美左上遮罩,Arial,48,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,1,8,8,11,1
|
180 |
+
Style: 多美紫色遮罩,Arial,48,&H00F05384,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,1,8,8,11,1
|
181 |
+
Style: 多美紫色屏字,仓耳渔阳体 W03,86,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,8,8,8,11,1
|
182 |
+
Style: 多美右上屏字,方正兰亭圆_GBK_细,60,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,94,100,6,0,1,0,3,9,8,45,100,1
|
183 |
+
Style: 屏字-黑,汉仪正圆-55S,71,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,8,8,8,11,1
|
184 |
+
|
185 |
+
[Events]
|
186 |
+
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
187 |
+
Dialogue: 0,0:00:00.30,0:00:03.00,staff1080p,,0,0,0,,{'''+r'''\fad(150,300)}特蕾纱熊猫观察会'''+r'''\N片源:'''+r'''\N翻译:'''+r'''\N时间:'''+r'''\N校压:''',
|
188 |
+
'head_str_sugawara':'''[Script Info]
|
189 |
+
; This is an Advanced Sub Station Alpha v4+ script.
|
190 |
+
; The script is generated by N46Whisper
|
191 |
+
Title:
|
192 |
+
ScriptType: v4.00+
|
193 |
+
Collisions: Normal
|
194 |
+
PlayDepth: 0
|
195 |
+
|
196 |
+
[V4+ Styles]
|
197 |
+
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
198 |
+
Style: 中字 1080P,思源黑体 CN Medium,90,&H00FFFFFF,&H00FFFFFF,&H008F51CA,&H00A860F2,-1,0,0,0,100,100,5,0,1,3.5,0,2,135,135,10,1
|
199 |
+
Style: staff 1080P,思源宋体 CN Medium,70,&H00FFFFFF,&H000000FF,&H008F51CA,&H00000000,0,0,0,0,100,100,0,0,1,4,2,7,10,10,10,1
|
200 |
+
Style: 标注 1080P,思源黑体 CN Medium,70,&H00FFFFFF,&HFFFFFFFF,&H00000000,&H7F000000,-1,0,0,0,100,100,0,0,1,3,1.5,8,0,0,15,1
|
201 |
+
Style: 中字 720P,思源黑体 CN Medium,60,&H00FFFFFF,&H00FFFFFF,&H008F51CA,&H00A860F2,-1,0,0,0,100,100,5,0,1,3,0,2,135,135,10,1
|
202 |
+
Style: staff 720P,思源宋体 CN Medium,50,&H00FFFFFF,&H000000FF,&H008F51CA,&H00000000,0,0,0,0,100,100,0,0,1,3,2,7,10,10,10,1
|
203 |
+
Style: 标注 720P,思源黑体 CN Medium,50,&H00FFFFFF,&HFFFFFFFF,&H00000000,&H7F000000,-1,0,0,0,100,100,0,0,1,3,1.5,8,0,0,15,1
|
204 |
+
Style: staff msg,思源宋体 CN Medium,25,&H00FFFFFF,&H000000FF,&H008F51CA,&H00000000,0,0,0,0,100,100,0,0,1,4,2,7,10,10,10,1
|
205 |
+
Style: 中字 msg,思源黑体 CN Medium,25,&H00FFFFFF,&H00FFFFFF,&H008F51CA,&H00A860F2,-1,0,0,0,100,100,5,0,1,4,0,2,135,135,10,1
|
206 |
+
Style: 标注 msg,思源黑体 CN Medium,25,&H00FFFFFF,&HFFFFFFFF,&H00000000,&H7F000000,-1,0,0,0,100,100,0,0,1,3,1.5,8,0,0,15,1
|
207 |
+
Style: 歌词日语 1080P,Swei Spring Sugar CJKtc,60,&H00FFFFFF,&H000000FF,&H009B46A5,&H5A9B46A5,0,0,0,0,100,100,0,0,1,2,0,2,10,10,30,1
|
208 |
+
Style: 歌词中文 1080P,Swei Spring Sugar CJKtc,90,&H00FFFFFF,&H000000FF,&H009B46A5,&H5F9B46A5,-1,0,0,0,100,100,0,0,1,2,0,2,10,10,100,1
|
209 |
+
Style: 歌词中文 720P,Swei Spring Sugar CJKtc,60,&H00FFFFFF,&H000000FF,&H009B46A5,&H5F9B46A5,-1,0,0,0,100,100,0,0,1,2,0,2,10,10,70,1
|
210 |
+
Style: 歌词日语 720P,Swei Spring Sugar CJKtc,40,&H00FFFFFF,&H000000FF,&H009B46A5,&H5A9B46A5,0,0,0,0,100,100,0,0,1,1,0,2,10,10,15,1
|
211 |
+
[Events]
|
212 |
+
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
213 |
+
Dialogue: 0,0:00:00.00,0:00:05.24,staff 1080P,,0,0,0,,{'''+r'''\fad(1200,50)\pos(15.2,0.4)}菅原咲月字幕组'''+r'''\N片源:'''+r'''\N翻译:'''+r'''\N时间:'''+r'''\N校压:''',
|
214 |
+
'head_str_kaede':'''[Script Info]
|
215 |
+
; This is an Advanced Sub Station Alpha v4+ script.
|
216 |
+
; The script is generated by N46Whisper
|
217 |
+
Title:
|
218 |
+
ScriptType: v4.00+
|
219 |
+
Collisions: Normal
|
220 |
+
PlayDepth: 0
|
221 |
+
|
222 |
+
[V4+ Styles]
|
223 |
+
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
224 |
+
Style: staff,微软雅黑,60,&H00FFFFFF,&H00923782,&H0076137B,&H00540D67,-1,0,0,0,100,100,0,0,1,3,0,7,15,15,15,1
|
225 |
+
Style: den SR红色,微软雅黑,70,&H0AFFFFFF,&H004B4B9E,&H322828E0,&H640A0A72,-1,0,0,0,100,100,0,0,1,3,0,2,15,15,70,1
|
226 |
+
Style: 注释,微软雅黑,68,&H00FFFFFF,&H000000FF,&H3D000000,&H00FFFFFF,-1,0,0,0,100,100,0,0,1,4.5,0,8,23,23,23,1
|
227 |
+
Style: 红色,微软雅黑,75,&H00FFFFFF,&H000000FF,&H004243CB,&H00000000,-1,0,0,0,100,100,0,0,1,3,0,2,15,15,15,1
|
228 |
+
Style: den - 中文歌词,微软雅黑,70,&H0AFFFFFF,&H004B4B9E,&H322828E0,&H640A0A72,-1,0,0,0,100,100,0,0,1,3,0,2,15,15,70,1
|
229 |
+
Style: den - 日文歌词,微软雅黑,50,&H0AFFFFFF,&H00F9F9F9,&H32000001,&H640A0A72,-1,0,0,0,100,100,0,0,1,1,0,2,15,15,9,1
|
230 |
+
[Events]
|
231 |
+
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
232 |
+
Dialogue: 0,0:00:00.00,0:00:05.00,staff,,0,0,0,,{'''+r'''\fad(300,300)}「三番目の楓」'''+r'''\N片源:'''+r'''\N翻译:'''+r'''\N时间:'''+r'''\N校压:''',
|
233 |
+
'head_str_taniguchi':'''[Script Info]
|
234 |
+
; This is an Advanced Sub Station Alpha v4+ script.
|
235 |
+
; The script is generated by N46Whisper
|
236 |
+
Title:
|
237 |
+
ScriptType: v4.00+
|
238 |
+
Collisions: Normal
|
239 |
+
PlayDepth: 0
|
240 |
+
|
241 |
+
[V4+ Styles]
|
242 |
+
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
243 |
+
Style: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
|
244 |
+
Style: 正文_1080P,思源黑体 CN Bold,75,&H00FFFFFF,&H000000FF,&H0077234B,&HA00000FF,-1,0,0,0,100,100,3,0,1,3,2,2,10,10,15,1
|
245 |
+
Style: staff_1080P,思源宋体 CN Heavy,60,&H00FFFFFF,&H000000FF,&H0077234B,&HA00000FF,-1,0,0,0,100,100,2,0,1,2,1,7,30,10,30,1
|
246 |
+
|
247 |
+
[Events]
|
248 |
+
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
249 |
+
Dialogue: 0,0:00:01.00,0:00:10.00,staff_1080P,,0,0,0,,{'''+r'''\fad(300,1000)}泪痣愛季応援団 '''+r'''\N源:'''+r'''\N制作:
|
250 |
+
Dialogue: 0,0:00:08.95,0:03:29.40,staff_1080P,,0,0,0,,{'''+r'''\fad(1000,1000)'''+r'''\pos(30,30)'''+r'''\bord0'''+r'''\shad0'''+r'''\c&HFFFFFF&'''+r'''\1a&H3C&}泪痣愛季応援団
|
251 |
+
Dialogue: 0,0:00:00.00,0:00:05.00,正文_1080P,,0,0,0,,谷口爱季字幕组''',
|
252 |
+
'head_str_asuka':'''[Script Info]
|
253 |
+
; The script is generated by N46Whisper
|
254 |
+
; http://www.aegisub.org/
|
255 |
+
Title: Default Aegisub file
|
256 |
+
ScriptType: v4.00+
|
257 |
+
WrapStyle: 0
|
258 |
+
ScaledBorderAndShadow: yes
|
259 |
+
YCbCr Matrix: None
|
260 |
+
|
261 |
+
[Aegisub Project Garbage]
|
262 |
+
|
263 |
+
[V4+ Styles]
|
264 |
+
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
265 |
+
Style: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
|
266 |
+
Style: DEFAULT1,微软雅黑,65,&H00FFFFFF,&HF08B581A,&H007E672E,&H0084561E,-1,0,0,0,100,100,0,0,1,2,1,2,20,20,5,1
|
267 |
+
Style: STAFF,Microsoft YaHei,50,&H00FFFFFF,&HF08B581A,&H007E672E,&HF084561E,-1,0,0,0,100,100,0,0,1,2.5,3,7,30,30,3,134
|
268 |
+
Style: 名单1,方正粗倩_GBK,45,&H00E7D793,&H00E9C116,&H004C3F00,&H0016161D,-1,0,0,0,100,100,0,0,1,3,2,2,10,10,10,1
|
269 |
+
Style: 名单2,方正粗黑简体,45,&H00FAF9EC,&H00493F15,&H008A4D1F,&H000A0A0B,-1,0,0,0,100,100,0,0,1,3,1.5,2,10,10,10,1
|
270 |
+
Style: 中文歌词,方正粗黑简体,50,&H00FFFFFF,&HF0000000,&H00000000,&H96000000,-1,0,0,0,100,100,0,0,1,1.5,2,2,10,10,4,134
|
271 |
+
Style: 日文歌词,方正粗黑简体,40,&H00FFFFFF,&HF0000000,&H00000000,&H96000000,-1,0,0,0,100,100,0,0,1,1.5,2,2,10,10,10,134
|
272 |
+
Style: 屏幕字/注释,微软雅黑,50,&H00FFFFFF,&HF0000000,&H00000000,&H96000000,-1,0,0,0,100,100,0,0,1,1.5,2,2,10,10,10,134
|
273 |
+
Style: purple1,文鼎特圆简,26,&H00670067,&H00FFFFFF,&H00FFFFFF,&H00FFFFFF,0,0,0,0,100,100,0,0,1,4.6,0,2,10,10,10,1
|
274 |
+
Style: 鸟,微软雅黑,35,&H00FFFFFF,&HF08B581A,&H00F3B70F,&H0084561E,-1,0,0,0,100,100,0,0,1,2,1,2,100,20,465,1
|
275 |
+
Style: 哈利,微软雅黑,35,&H00FFFFFF,&HF08B581A,&H00445FE1,&H00445FE1,-1,0,0,0,100,100,0,0,1,2,1,2,0,150,220,1
|
276 |
+
Style: 期数,Berlin Sans FB,25,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,1,9,10,10,0,1
|
277 |
+
Style: HamAsuka-屏幕字,方正卡通_GBK,50,&H00FFFFFF,&H000000FF,&H00D08C27,&H00010102,-1,0,0,0,100,100,0,0,1,3.5,3,2,900,10,170,1
|
278 |
+
Style: HamAsuka-屏幕字 小黑,方正粗黑宋简体,65,&H00000000,&H000000FF,&H00FFFFFF,&H00010102,0,0,0,0,100,100,0,0,1,0,0,2,10,10,170,1
|
279 |
+
Style: HamAsuka-屏幕字 蓝底,微软雅黑,80,&H00FFFFFF,&H000000FF,&H00A21C14,&H00FFFFFF,-1,0,0,0,100,100,0,0,3,4,0,2,10,10,10,1
|
280 |
+
Style: HamAsuka-屏幕字 标题,微软雅黑,90,&H00303030,&H0006C6F6,&H00FFFFFF,&H00010102,-1,0,0,0,100,100,0,0,1,0,0,2,10,10,10,1
|
281 |
+
Style: HamAsuka-屏幕字 问题 白底,微软雅黑,90,&H002C2C2C,&H00B77B1B,&H00FFFFFF,&H00010102,-1,0,0,0,100,100,0,0,3,5,0,2,10,10,10,1
|
282 |
+
Style: HamAsuka 歌词,微软雅黑,70,&H00FFFFFF,&H00000000,&H00000000,&H00010102,-1,0,0,0,100,100,0,0,1,0,0,2,10,10,10,1
|
283 |
+
Style: HamAsuka 小窗,微软雅黑,50,&H00FFFFFF,&HF0000000,&H00000000,&H96000000,-1,0,0,0,100,100,0,0,1,1.5,2,9,10,10,300,134
|
284 |
+
Style: HamAsuka-屏幕字 标题 蓝底,微软雅黑,90,&H00F9F8FB,&H000000FF,&H00AC9769,&H00000000,-1,0,0,0,100,100,0,0,3,5,0,2,10,10,10,1
|
285 |
+
Style: HamAsuka-屏幕字 标题 黑字,微软雅黑,80,&H00292B2C,&H000000FF,&H00FFFFFF,&H00000000,-1,0,0,0,100,100,0,0,3,5,0,2,10,10,10,1
|
286 |
+
Style: 毕业曲MV 中文歌词,思源黑体 CN,76,&H0AFFFFFF,&H000000FF,&H0F000000,&H00FFFFFF,-1,0,0,0,100,100,0,0,1,1,0,2,10,10,75,1
|
287 |
+
Style: 毕业曲MV 日文歌词,思源黑体 CN,58,&H0AFFFFFF,&H000000FF,&H0F000000,&H00FFFFFF,-1,0,0,0,100,100,0,0,1,1,0,2,10,10,15,1
|
288 |
+
|
289 |
+
[Events]
|
290 |
+
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
291 |
+
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,'''
|
292 |
+
# ADD MORE
|
293 |
+
|
294 |
+
}
|
295 |
+
|
296 |
+
|
297 |
+
# if __name__ == "__main__":
|
298 |
+
# srt2ass('sub_split_test.srt','sugawaraCN','No','Aggressive')
|