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
update command line call
shixian.shi106055428a25
diff --git a/paraclipper/trans_utils.py b/paraclipper/trans_utils.pyindex 2485583..dc7438b 100644--- a/paraclipper/trans_utils.py+++ b/paraclipper/trans_utils.py@@ -55,7 +55,7 @@ def generate_vad_data(data, sd_sentences, sr=16000):return vad_datadef write_state(output_dir, state):- for key in ['/recog_res_raw', '/timestamp', '/sentences', '/sd_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:diff --git a/paraclipper/videoclipper.py b/paraclipper/videoclipper.pyindex 301cf56..b3440b5 100644--- a/paraclipper/videoclipper.py+++ b/paraclipper/videoclipper.py@@ -1,4 +1,5 @@import re+import osimport sysimport copyimport librosa@@ -11,7 +12,7 @@ from moviepy.editor import *from moviepy.video.tools.subtitles import SubtitlesClipfrom subtitle_utils import generate_srt, generate_srt_clipfrom argparse_tools import ArgumentParser, get_commandline_args-from trans_utils import pre_proc, proc, write_state, load_state, proc_spk, generate_vad_data+from trans_utils import pre_proc, proc, write_state, load_state, proc_spkclass VideoClipper():@@ -194,7 +195,7 @@ class VideoClipper():# _video_clip.write_videofile("debug.mp4", audio_codec="aac")concate_clip.append(copy.copy(_video_clip))time_acc_ost += end+end_ost/1000.0 - (start+start_ost/1000.0)- message = "{} periods found in the audio: ".format(len(ts)) + start_end_info + log_append+ message = "{} periods found in the audio: ".format(len(ts)) + start_end_infologging.warning("Concating...")if len(concate_clip) > 1:video_clip = concatenate_videoclips(concate_clip)@@ -232,7 +233,7 @@ def get_parser():type=str,choices=("no", "yes"),default="no",- help="Trun on the speaker diarization or not",+ help="Turn on the speaker diarization or not",)parser.add_argument("--output_dir",@@ -284,6 +285,8 @@ def runner(stage, file, sd_switch, output_dir, dest_text, dest_spk, start_ost, elogging.error("Unsupported file format: {}".format(file))while output_dir.endswith('/'):output_dir = output_dir[:-1]+ if not os.path.exists(output_dir):+ os.mkdir(output_dir)if stage == 1:from funasr import AutoModel# initialize funasr automodel