From 6245b0b9122b345df2e5fdbf703d74f09a290c70 Mon Sep 17 00:00:00 2001 From: McCloudS <64094529+McCloudS@users.noreply.github.com> Date: Sat, 7 Sep 2024 23:07:08 -0600 Subject: [PATCH] More audio codec checks --- subgen.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subgen.py b/subgen.py index e07c5c5..41fc2f9 100644 --- a/subgen.py +++ b/subgen.py @@ -818,11 +818,11 @@ def has_audio(file_path): # Check for an audio stream and ensure it has a valid codec for stream in container.streams: if stream.type == 'audio': - # Check if the codec is supported (not 'none') - if stream.codec.name != 'none': + # Check if the stream has a codec and if it is valid + if stream.codec and stream.codec.name != 'none': return True else: - logging.debug(f"Unsupported codec for audio stream in {file_path}") + logging.debug(f"Unsupported or missing codec for audio stream in {file_path}") return False except (av.AVError, UnicodeDecodeError):