From 6a57c524c07e485a89b18a7060e45a95201d9505 Mon Sep 17 00:00:00 2001 From: Antonio Zarauz Moreno <87022369+hedrergudene@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:39:28 +0200 Subject: [PATCH] Update transcribe.py provide an early exit in case no voice activity is detected. --- faster_whisper/transcribe.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/faster_whisper/transcribe.py b/faster_whisper/transcribe.py index 8652e82b..e710fa46 100644 --- a/faster_whisper/transcribe.py +++ b/faster_whisper/transcribe.py @@ -511,6 +511,10 @@ def transcribe( all_language_probs=all_language_probs, ) + # Exit if no activity if found + if duration_after_vad==0: + return [], info + audio_segments, segments_metadata = self.audio_split( audio, vad_segments, sampling_rate )