Skip to content

Commit f81c675

Browse files
committed
bug fix
1 parent 733aa85 commit f81c675

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

funclip/utils/trans_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def proc_spk(dest_spk, sd_sentences):
4848
d_end = d['timestamp'][-1][1]
4949
spkid=dest_spk[3:]
5050
if str(d['spk']) == spkid and d_end-d_start>999:
51-
ts.append([d['start']*16, d['end']*16])
51+
ts.append([d_start*16, d_end*16])
5252
return ts
5353

5454
def generate_vad_data(data, sd_sentences, sr=16000):

funclip/videoclipper.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def __init__(self, funasr_model):
2525
logging.warning("Initializing VideoClipper.")
2626
self.funasr_model = funasr_model
2727
self.GLOBAL_COUNT = 0
28-
self.lang = "zh"
2928

3029
def recog(self, audio_input, sd_switch='no', state=None, hotwords="", output_dir=None):
3130
if state is None:
@@ -243,7 +242,7 @@ def video_clip(self,
243242
chi_subs.append(((sub[0][0]-sub_starts, sub[0][1]-sub_starts), sub[1]))
244243
start, end = start+start_ost/1000.0, end+end_ost/1000.0
245244
_video_clip = video.subclip(start, end)
246-
start_end_info += ", from {} to {}".format(start, end)
245+
start_end_info += ", from {} to {}".format(str(start)[:5], str(end)[:5])
247246
clip_srt += srt_clip
248247
if add_sub:
249248
generator = lambda txt: TextClip(txt, font='./font/STHeitiMedium.ttc', fontsize=font_size, color=font_color)
@@ -341,13 +340,13 @@ def get_parser():
341340
parser.add_argument(
342341
"--lang",
343342
type=str,
344-
default="zh",
345-
help="Language choice"
343+
default='zh',
344+
help="language"
346345
)
347346
return parser
348347

349348

350-
def runner(stage, file, sd_switch, output_dir, dest_text, dest_spk, start_ost, end_ost, output_file, lang="zh", config=None):
349+
def runner(stage, file, sd_switch, output_dir, dest_text, dest_spk, start_ost, end_ost, output_file, config=None, lang='zh'):
351350
audio_suffixs = ['.wav','.mp3','.aac','.m4a','.flac']
352351
video_suffixs = ['.mp4','.avi','.mkv','.flv','.mov','.webm','.ts','.mpeg']
353352
_,ext = os.path.splitext(file)
@@ -366,7 +365,7 @@ def runner(stage, file, sd_switch, output_dir, dest_text, dest_spk, start_ost, e
366365
from funasr import AutoModel
367366
# initialize funasr automodel
368367
logging.warning("Initializing modelscope asr pipeline.")
369-
if lang == "zh":
368+
if lang == 'zh':
370369
funasr_model = AutoModel(model="iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
371370
vad_model="damo/speech_fsmn_vad_zh-cn-16k-common-pytorch",
372371
punc_model="damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch",
@@ -439,4 +438,4 @@ def main(cmd=None):
439438

440439

441440
if __name__ == '__main__':
442-
main()
441+
main()

0 commit comments

Comments
 (0)