diff --git a/funclip/videoclipper.py b/funclip/videoclipper.py index 14097e5..9475b08 100644 --- a/funclip/videoclipper.py +++ b/funclip/videoclipper.py @@ -152,6 +152,11 @@ def video_recog(self, video_filename, sd_switch='no', hotwords="", output_dir=No base_name, _ = os.path.splitext(video_filename) clip_video_file = base_name + '_clip.mp4' audio_file = base_name + '.wav' + + if video.audio is None: + logging.error("No audio information found.") + sys.exit(1) + video.audio.write_audiofile(audio_file) wav = librosa.load(audio_file, sr=16000)[0] # delete the audio file after processing @@ -441,4 +446,4 @@ def main(cmd=None): if __name__ == '__main__': - main() \ No newline at end of file + main()