Skip to content

FunASR-powered video transcription, subtitle generation, and LLM-assisted clipping tool with a local Gradio UI.

update resample for audio

shixian.shief79f77eb642
diff --git a/paraclipper/videoclipper.py b/paraclipper/videoclipper.py
index 6d9b91c..fc04904 100644
--- a/paraclipper/videoclipper.py
+++ b/paraclipper/videoclipper.py
@@ -25,7 +25,9 @@ class VideoClipper():
if state is None:
state = {}
sr, data = audio_input
- assert sr == 16000, "16kHz sample rate required, {} given.".format(sr)
+ # assert sr == 16000, "16kHz sample rate required, {} given.".format(sr)
+ if sr != 16000: # resample with librosa
+ data = librosa.resample(data, orig_sr=sr, target_sr=16000)
if len(data.shape) == 2: # multi-channel wav input
logging.warning("Input wav shape: {}, only first channel reserved.").format(data.shape)
data = data[:,0]