FunASR-powered video transcription, subtitle generation, and LLM-assisted clipping tool with a local Gradio UI.
Python ai-toolsai-video-editingasrauto-subtitleschinesecontent-creationfunasrfunclipgradiollmparaformerspeech-recognitionspeech-to-textsubtitles-generatortranscriptionvideo-editingvideo-processingvideo-subtitlesvideo-transcriptionwhisper-alternative
add speaker diarization
Wang-Hui09787f64f690
diff --git a/ClipVideo/clipvideo/gradio_service.py b/ClipVideo/clipvideo/gradio_service.pyindex 514479d..0cb8e06 100644--- a/ClipVideo/clipvideo/gradio_service.py+++ b/ClipVideo/clipvideo/gradio_service.py@@ -2,7 +2,7 @@ import gradio as grfrom modelscope.pipelines import pipelinefrom modelscope.utils.constant import Tasksfrom videoclipper import VideoClipper-+from video import Videoif __name__ == "__main__":inference_pipeline = pipeline(@@ -11,34 +11,38 @@ if __name__ == "__main__":vad_model='damo/speech_fsmn_vad_zh-cn-16k-common-pytorch',punc_model='damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch',)- audio_clipper = VideoClipper(inference_pipeline)+ sd_pipeline = pipeline(+ task='speaker-diarization',+ model='damo/speech_campplus_speaker-diarization_common',+ model_revision='v1.0.0'+ )+ audio_clipper = VideoClipper(inference_pipeline, sd_pipeline)- def audio_recog(audio_input):- return audio_clipper.recog(audio_input)+ def audio_recog(audio_input, sd_switch):+ print(audio_input)+ return audio_clipper.recog(audio_input, sd_switch)- def audio_clip(dest_text, start_ost, end_ost, state):- return audio_clipper.clip(dest_text, start_ost, end_ost, state)+ def audio_clip(dest_text, audio_spk_input, start_ost, end_ost, state):+ return audio_clipper.clip(dest_text, start_ost, end_ost, state, dest_spk=audio_spk_input)- def video_recog(video_input):- return audio_clipper.video_recog(video_input)+ def video_recog(video_input, sd_switch):+ return audio_clipper.video_recog(video_input, sd_switch)- def video_clip(dest_text, start_ost, end_ost, state):- return audio_clipper.video_clip(dest_text, start_ost, end_ost, state)+ def video_clip(dest_text, video_spk_input, start_ost, end_ost, state):+ return audio_clipper.video_clip(dest_text, start_ost, end_ost, state, dest_spk=video_spk_input)- def video_clip_addsub(dest_text, start_ost, end_ost, state, font_size, font_color):- return audio_clipper.video_clip(dest_text, start_ost, end_ost, state, font_size, font_color, add_sub=True)+ def video_clip_addsub(dest_text, video_spk_input, start_ost, end_ost, state, font_size, font_color):+ return audio_clipper.video_clip(dest_text, start_ost, end_ost, state, font_size, font_color, add_sub=True, dest_spk=video_spk_input)- '''top_md_1 = ("""- 基于达摩院自研Paraformer-长音频版的语音识别、端点检测、标点预测、时间戳功能+ 基于达摩院自研Paraformer-长音频版的语音识别、端点检测、标点预测、时间戳功能、角色区分功能- 准确识别,自由复制所需段落并一键裁剪、添加字幕+ 准确识别,自由复制所需段落,或者设置说话人标识,一键裁剪、添加字幕- * Step1: 上传视频文件(或使用下方的用例体验),点击 **<font color="#f7802b">识别</font>** 按钮- * Step2: 复制识别结果中所需的文字至右上方,设置偏移与字幕配置(可选)+ * Step1: 上传视频或音频文件(或使用下方的用例体验),点击 **<font color="#f7802b">识别</font>** 按钮+ * Step2: 复制识别结果中所需的文字至右上方,或者右设置说话人标识,设置偏移与字幕配置(可选)* Step3: 点击 **<font color="#f7802b">裁剪</font>** 按钮或 **<font color="#f7802b">裁剪并添加字幕</font>** 按钮获得结果""")- '''top_md_2 = ("""受到网络传输与服务资源的限制,用于体验的视频最好大小在40mb以下@@ -64,25 +68,27 @@ if __name__ == "__main__":# gradio interfacewith gr.Blocks() as demo:#gr.Image("./examples/guide.png", show_label=False)- # gr.Markdown(top_md_1)- #gr.Markdown(top_md_2)- #gr.Markdown(top_md_3)+ gr.Markdown(top_md_1)+ gr.Markdown(top_md_2)+ gr.Markdown(top_md_3)video_state = gr.State()audio_state = gr.State()with gr.Tab("🎥✂️视频裁剪 Video Clipping"):with gr.Row():with gr.Column():- video_input = gr.Video(label="🎥视频输入 Video Input")+ video_input = Video(label="🎥视频输入 Video Input")gr.Examples(['https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ClipVideo/%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E5%A4%9A%E8%AF%BB%E4%B9%A6%EF%BC%9F%E8%BF%99%E6%98%AF%E6%88%91%E5%90%AC%E8%BF%87%E6%9C%80%E5%A5%BD%E7%9A%84%E7%AD%94%E6%A1%88-%E7%89%87%E6%AE%B5.mp4','https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ClipVideo/2022%E4%BA%91%E6%A0%96%E5%A4%A7%E4%BC%9A_%E7%89%87%E6%AE%B5.mp4','https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ClipVideo/2022%E4%BA%91%E6%A0%96%E5%A4%A7%E4%BC%9A_%E7%89%87%E6%AE%B52.mp4','https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ClipVideo/%E4%BD%BF%E7%94%A8chatgpt_%E7%89%87%E6%AE%B5.mp4'],[video_input])+ video_sd_switch = gr.Radio(["no", "yes"], label="👥是否区分说话人 Recognize Speakers", value='no')recog_button2 = gr.Button("👂识别 Recognize")video_text_output = gr.Textbox(label="✏️识别结果 Recognition Result")video_srt_output = gr.Textbox(label="📖SRT字幕内容 RST Subtitles")with gr.Column():video_text_input = gr.Textbox(label="✏️待裁剪文本 Text to Clip (多段文本使用'#'连接)")+ video_spk_input = gr.Textbox(label="✏️待裁剪说话人 Speaker to Clip (多个说话人使用'#'连接)")with gr.Row():video_start_ost = gr.Slider(minimum=-500, maximum=1000, value=0, step=50, label="⏪开始位置偏移 Start Offset (ms)")video_end_ost = gr.Slider(minimum=-500, maximum=1000, value=100, step=50, label="⏩结束位置偏移 End Offset (ms)")@@ -102,11 +108,13 @@ if __name__ == "__main__":with gr.Column():audio_input = gr.Audio(label="🔊音频输入 Audio Input")gr.Examples(['https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ClipVideo/%E9%B2%81%E8%82%83%E9%87%87%E8%AE%BF%E7%89%87%E6%AE%B51.wav'], [audio_input])+ audio_sd_switch = gr.Radio(["no", "yes"], label="👥是否区分说话人 Recognize Speakers", value='no')recog_button1 = gr.Button("👂识别 Recognize")audio_text_output = gr.Textbox(label="✏️识别结果 Recognition Result")audio_srt_output = gr.Textbox(label="📖SRT字幕内容 RST Subtitles")with gr.Column():audio_text_input = gr.Textbox(label="✏️待裁剪文本 Text to Clip (多段文本使用'#'连接)")+ audio_spk_input = gr.Textbox(label="✏️待裁剪说话人 Speaker to Clip (多个说话人使用'#'连接)")with gr.Row():audio_start_ost = gr.Slider(minimum=-500, maximum=1000, value=0, step=50, label="⏪开始位置偏移 Start Offset (ms)")audio_end_ost = gr.Slider(minimum=-500, maximum=1000, value=100, step=50, label="⏩结束位置偏移 End Offset (ms)")@@ -117,20 +125,20 @@ if __name__ == "__main__":audio_srt_clip_output = gr.Textbox(label="📖裁剪部分SRT字幕内容 Clipped RST Subtitles")recog_button1.click(audio_recog,- inputs=audio_input,+ inputs=[audio_input, audio_sd_switch],outputs=[audio_text_output, audio_srt_output, audio_state])clip_button1.click(audio_clip,- inputs=[audio_text_input, audio_start_ost, audio_end_ost, audio_state],+ inputs=[audio_text_input, audio_spk_input, audio_start_ost, audio_end_ost, audio_state],outputs=[audio_output, audio_mess_output, audio_srt_clip_output])recog_button2.click(video_recog,- inputs=video_input,+ inputs=[video_input, video_sd_switch],outputs=[video_text_output, video_srt_output, video_state])clip_button2.click(video_clip,- inputs=[video_text_input, video_start_ost, video_end_ost, video_state],+ inputs=[video_text_input, video_spk_input, video_start_ost, video_end_ost, video_state],outputs=[video_output, video_mess_output, video_srt_clip_output])clip_button3.click(video_clip_addsub,- inputs=[video_text_input, video_start_ost, video_end_ost, video_state, font_size, font_color],+ inputs=[video_text_input, video_spk_input, video_start_ost, video_end_ost, video_state, font_size, font_color],outputs=[video_output, video_mess_output, video_srt_clip_output])# start gradio service in localdiff --git a/ClipVideo/clipvideo/subtitle_utils.py b/ClipVideo/clipvideo/subtitle_utils.pyindex a3d9a47..d1f7f7b 100644--- a/ClipVideo/clipvideo/subtitle_utils.py+++ b/ClipVideo/clipvideo/subtitle_utils.py@@ -39,12 +39,34 @@ class Text2SRT():def time(self):return (self.start_sec/1000, self.end_sec/1000)+def distribute_spk(sentence_list, sd_time_list):+ sd_sentence_list = []+ for d in sentence_list:+ sentence_start = d['ts_list'][0][0]+ sentence_end = d['ts_list'][-1][1]+ sentence_spk = 0+ max_overlap = 0+ for sd_time in sd_time_list:+ spk_st, spk_ed, spk = sd_time+ spk_st = spk_st*1000+ spk_ed = spk_ed*1000+ overlap = max(+ min(sentence_end, spk_ed) - max(sentence_start, spk_st), 0)+ if overlap > max_overlap:+ max_overlap = overlap+ sentence_spk = spk+ d['spk'] = sentence_spk+ sd_sentence_list.append(d)+ return sd_sentence_listdef generate_srt(sentence_list):srt_total = ''for i, d in enumerate(sentence_list):t2s = Text2SRT(d['text_seg'], d['ts_list'])- srt_total += "{}\n{}".format(i, t2s.srt())+ if 'spk' in d:+ srt_total += "{} spk{}\n{}".format(i, d['spk'], t2s.srt())+ else:+ srt_total += "{}\n{}".format(i, t2s.srt())return srt_totaldef generate_srt_clip(sentence_list, start, end, begin_index=0):diff --git a/ClipVideo/clipvideo/test.sh b/ClipVideo/clipvideo/test.shindex fa2549b..31a0ef3 100755--- a/ClipVideo/clipvideo/test.sh+++ b/ClipVideo/clipvideo/test.sh@@ -1,6 +1,7 @@# step1: Recognizepython videoclipper.py --stage 1 \--file ../examples/2022云栖大会_片段.mp4 \+ --sd_switch yes \--output_dir ./output# now you can find recognition results and entire SRT file in ./output/# step2: Clip@@ -8,6 +9,7 @@ python videoclipper.py --stage 2 \--file ../examples/2022云栖大会_片段.mp4 \--output_dir ./output \--dest_text '所以这个是我们办这个奖的初心啊,我们也会一届一届的办下去' \+ # --dest_spk spk0 \--start_ost 0 \--end_ost 100 \--output_file './output/res.mp4'\ No newline at end of filediff --git a/ClipVideo/clipvideo/trans_utils.py b/ClipVideo/clipvideo/trans_utils.pyindex 10bd7c7..a630249 100644--- a/ClipVideo/clipvideo/trans_utils.py+++ b/ClipVideo/clipvideo/trans_utils.py@@ -34,13 +34,34 @@ def proc(raw_text, timestamp, dest_text):# import pdb; pdb.set_trace()return ts+def proc_spk(dest_spk, sd_sentences):+ ts = []+ for d in sd_sentences:+ d_start = d['ts_list'][0][0]+ d_end = d['ts_list'][-1][1]+ spkid=dest_spk[3:]+ if str(d['spk']) == spkid and d_end-d_start>999:+ ts.append([d['start']*16, d['end']*16])+ return ts++def generate_vad_data(data, sd_sentences, sr=16000):+ assert len(data.shape) == 1+ vad_data = []+ for d in sd_sentences:+ d_start = round(d['ts_list'][0][0]/1000, 2)+ d_end = round(d['ts_list'][-1][1]/1000, 2)+ vad_data.append([d_start, d_end, data[int(d_start * sr):int(d_end * sr)]])+ return vad_datadef write_state(output_dir, state):- for key in ['/recog_res_raw', '/timestamp', '/sentences']:+ for key in ['/recog_res_raw', '/timestamp', '/sentences', '/sd_sentences']:with open(output_dir+key, 'w') as fout:fout.write(str(state[key[1:]]))+ if 'sd_sentences' in state:+ with open(output_dir+'/sd_sentences', 'w') as fout:+ fout.write(str(state['sd_sentences']))-+import osdef load_state(output_dir):state = {}with open(output_dir+'/recog_res_raw') as fin:@@ -52,6 +73,10 @@ def load_state(output_dir):with open(output_dir+'/sentences') as fin:line = fin.read()state['sentences'] = eval(line)+ if os.path.exists(output_dir+'/sd_sentences'):+ with open(output_dir+'/sd_sentences') as fin:+ line = fin.read()+ state['sd_sentences'] = eval(line)return state\ No newline at end of filediff --git a/ClipVideo/clipvideo/video.py b/ClipVideo/clipvideo/video.pynew file mode 100644index 0000000..ee70592--- /dev/null+++ b/ClipVideo/clipvideo/video.py@@ -0,0 +1,72 @@+import gradio+from pathlib import Path+from ffmpy import FFmpeg+from gradio import utils+from gradio_client.documentation import document, set_documentation_group+set_documentation_group("component")++@document()+class Video(gradio.Video):+ """+ This is adapted from gradio.Video. Only `def preprocess()` is modified for auto recoginzing input x is local data or url+ """+ def preprocess(self, x):+ """+ Parameters:+ x: A tuple of (video file data, subtitle file data) or just video file data.+ Returns:+ A string file path or URL to the preprocessed video. Subtitle file data is ignored.+ """+ if x is None:+ return None+ elif isinstance(x, dict):+ video = x+ else:+ video = x[0]++ file_name, file_data, is_file = (+ video.get("name"),+ video["data"],+ video.get("is_file", False),+ )++ if is_file:+ assert file_name is not None, "Received file data without a file name."+ if utils.validate_url(file_name): # URL path+ file_name = Path(self.download_temp_copy_if_needed(file_name))+ else: # Local path+ file_name = Path(self.make_temp_copy_if_needed(file_name))+ else:+ assert file_data is not None, "Received empty file data."+ file_name = Path(self.base64_to_temp_file_if_needed(file_data, file_name))++ uploaded_format = file_name.suffix.replace(".", "")+ needs_formatting = self.format is not None and uploaded_format != self.format+ flip = self.source == "webcam" and self.mirror_webcam++ if needs_formatting or flip:+ format = f".{self.format if needs_formatting else uploaded_format}"+ output_options = ["-vf", "hflip", "-c:a", "copy"] if flip else []+ output_options += ["-an"] if not self.include_audio else []+ flip_suffix = "_flip" if flip else ""+ output_file_name = str(+ file_name.with_name(f"{file_name.stem}{flip_suffix}{format}")+ )+ if Path(output_file_name).exists():+ return output_file_name+ ff = FFmpeg(+ inputs={str(file_name): None},+ outputs={output_file_name: output_options},+ )+ ff.run()+ return output_file_name+ elif not self.include_audio:+ output_file_name = str(file_name.with_name(f"muted_{file_name.name}"))+ ff = FFmpeg(+ inputs={str(file_name): None},+ outputs={output_file_name: ["-an"]},+ )+ ff.run()+ return output_file_name+ else:+ return str(file_name)diff --git a/ClipVideo/clipvideo/videoclipper.py b/ClipVideo/clipvideo/videoclipper.pyindex 491bc45..37a7d9b 100644--- a/ClipVideo/clipvideo/videoclipper.py+++ b/ClipVideo/clipvideo/videoclipper.py@@ -1,4 +1,5 @@import sys+sys.path.append('/Users/wanghui/gitlab/MaaS-lib')import copyimport librosaimport logging@@ -8,8 +9,8 @@ import soundfile as sfimport moviepy.editor as mpy# from modelscope.pipelines import pipeline# from modelscope.utils.constant import Tasks-from subtitle_utils import generate_srt, generate_srt_clip-from trans_utils import pre_proc, proc, write_state, load_state+from subtitle_utils import generate_srt, generate_srt_clip, distribute_spk+from trans_utils import pre_proc, proc, write_state, load_state, proc_spk, generate_vad_datafrom argparse_tools import ArgumentParser, get_commandline_argsfrom moviepy.editor import *@@ -17,11 +18,12 @@ from moviepy.video.tools.subtitles import SubtitlesClipclass VideoClipper():- def __init__(self, asr_pipeline):+ def __init__(self, asr_pipeline, sd_pipeline=None):logging.warning("Initializing VideoClipper.")self.asr_pipeline = asr_pipeline+ self.sd_pipeline = sd_pipeline- def recog(self, audio_input, state=None):+ def recog(self, audio_input, sd_switch='no', state=None):if state is None:state = {}sr, data = audio_input@@ -32,14 +34,21 @@ class VideoClipper():state['audio_input'] = (sr, data)data = data.astype(np.float64)rec_result = self.asr_pipeline(audio_in=data)+ if sd_switch == 'yes':+ vad_data = generate_vad_data(data.astype(np.float32), rec_result['sentences'], sr)+ sd_result = self.sd_pipeline(audio=vad_data, batch_size=1)+ rec_result['sd_sentences'] = distribute_spk(rec_result['sentences'], sd_result['text'])+ res_srt = generate_srt(rec_result['sd_sentences'])+ state['sd_sentences'] = rec_result['sd_sentences']+ else:+ res_srt = generate_srt(rec_result['sentences'])state['recog_res_raw'] = rec_result['text_postprocessed']state['timestamp'] = rec_result['time_stamp']state['sentences'] = rec_result['sentences']res_text = rec_result['text']- res_srt = generate_srt(rec_result['sentences'])return res_text, res_srt, state- def clip(self, dest_text, start_ost, end_ost, state):+ def clip(self, dest_text, start_ost, end_ost, state, dest_spk=None):# get from stateaudio_input = state['audio_input']recog_res_raw = state['recog_res_raw']@@ -49,11 +58,17 @@ class VideoClipper():data = data.astype(np.float64)all_ts = []- for _dest_text in dest_text.split('#'):- _dest_text = pre_proc(_dest_text)- ts = proc(recog_res_raw, timestamp, _dest_text)- for _ts in ts: all_ts.append(_ts)+ if dest_spk is None or dest_spk == '' or 'sd_sentences' not in state:+ for _dest_text in dest_text.split('#'):+ _dest_text = pre_proc(_dest_text)+ ts = proc(recog_res_raw, timestamp, _dest_text)+ for _ts in ts: all_ts.append(_ts)+ else:+ for _dest_spk in dest_spk.split('#'):+ ts = proc_spk(_dest_spk, state['sd_sentences'])+ for _ts in ts: all_ts.append(_ts)ts = all_ts+ ts.sort()srt_index = 0clip_srt = ""if len(ts):@@ -79,7 +94,7 @@ class VideoClipper():res_audio = datareturn (sr, res_audio), message, clip_srt- def video_recog(self, vedio_filename):+ def video_recog(self, vedio_filename, sd_switch='no'):vedio_filename = vedio_filenameclip_video_file = vedio_filename[:-4] + '_clip.mp4'video = mpy.VideoFileClip(vedio_filename)@@ -92,9 +107,9 @@ class VideoClipper():'video': video,}# res_text, res_srt = self.recog((16000, wav), state)- return self.recog((16000, wav), state)+ return self.recog((16000, wav), sd_switch, state)- def video_clip(self, dest_text, start_ost, end_ost, state, font_size=32, font_color='white', add_sub=False):+ def video_clip(self, dest_text, start_ost, end_ost, state, font_size=32, font_color='white', add_sub=False, dest_spk=None):# get from staterecog_res_raw = state['recog_res_raw']timestamp = state['timestamp']@@ -105,11 +120,17 @@ class VideoClipper():all_ts = []srt_index = 0- for _dest_text in dest_text.split('#'):- _dest_text = pre_proc(_dest_text)- ts = proc(recog_res_raw, timestamp, _dest_text)- for _ts in ts: all_ts.append(_ts)+ if dest_spk is None or dest_spk == '' or 'sd_sentences' not in state:+ for _dest_text in dest_text.split('#'):+ _dest_text = pre_proc(_dest_text)+ ts = proc(recog_res_raw, timestamp, _dest_text)+ for _ts in ts: all_ts.append(_ts)+ else:+ for _dest_spk in dest_spk.split('#'):+ ts = proc_spk(_dest_spk, state['sd_sentences'])+ for _ts in ts: all_ts.append(_ts)ts = all_ts+ ts.sort()clip_srt = ""if len(ts):start, end = ts[0][0] / 16000, ts[0][1] / 16000@@ -166,6 +187,13 @@ def get_parser():help="Input file path",required=True)+ parser.add_argument(+ "--sd_switch",+ type=str,+ choices=("no", "yes"),+ default="no",+ help="Trun on the speaker diarization or not",+ )parser.add_argument("--output_dir",type=str,@@ -178,6 +206,12 @@ def get_parser():default=None,help="Destination text string for clipping",)+ parser.add_argument(+ "--dest_spk",+ type=str,+ default=None,+ help="Destination spk id for clipping",+ )parser.add_argument("--start_ost",type=int,@@ -199,7 +233,7 @@ def get_parser():return parser-def runner(stage, file, output_dir, dest_text, start_ost, end_ost, output_file, config=None):+def runner(stage, file, sd_switch, output_dir, dest_text, dest_spk, start_ost, end_ost, output_file, config=None):audio_suffixs = ['wav']video_suffixs = ['mp4']if file[-3:] in audio_suffixs:@@ -222,14 +256,19 @@ def runner(stage, file, output_dir, dest_text, start_ost, end_ost, output_file,punc_model='damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch',output_dir=output_dir,)- audio_clipper = VideoClipper(inference_pipeline)+ sd_pipeline = pipeline(+ task='speaker-diarization',+ model='damo/speech_campplus_speaker-diarization_common',+ model_revision='v1.0.0'+ )+ audio_clipper = VideoClipper(inference_pipeline, sd_pipeline)if mode == 'audio':logging.warning("Recognizing audio file: {}".format(file))wav, sr = librosa.load(file, sr=16000)- res_text, res_srt, state = audio_clipper.recog((sr, wav))+ res_text, res_srt, state = audio_clipper.recog((sr, wav), sd_switch)if mode == 'video':logging.warning("Recognizing video file: {}".format(file))- res_text, res_srt, state = audio_clipper.video_recog(file)+ res_text, res_srt, state = audio_clipper.video_recog(file, sd_switch)total_srt_file = output_dir + '/total.srt'with open(total_srt_file, 'w') as fout:fout.write(res_srt)@@ -243,7 +282,7 @@ def runner(stage, file, output_dir, dest_text, start_ost, end_ost, output_file,state = load_state(output_dir)wav, sr = librosa.load(file, sr=16000)state['audio_input'] = (sr, wav)- (sr, audio), message, srt_clip = audio_clipper.clip(dest_text, start_ost, end_ost, state)+ (sr, audio), message, srt_clip = audio_clipper.clip(dest_text, start_ost, end_ost, state, dest_spk=dest_spk)if output_file is None:output_file = output_dir + '/result.wav'clip_srt_file = output_file[:-3] + 'srt'@@ -263,7 +302,7 @@ def runner(stage, file, output_dir, dest_text, start_ost, end_ost, output_file,state['clip_video_file'] = output_fileclip_srt_file = state['clip_video_file'][:-3] + 'srt'state['video'] = mpy.VideoFileClip(file)- clip_video_file, message, srt_clip = audio_clipper.video_clip(dest_text, start_ost, end_ost, state)+ clip_video_file, message, srt_clip = audio_clipper.video_clip(dest_text, start_ost, end_ost, state, dest_spk=dest_spk)logging.warning("Clipping Log: {}".format(message))logging.warning("Save clipped mp4 file to {}".format(clip_video_file))with open(clip_srt_file, 'w') as fout: