Skip to content

Commit

Permalink
More audio codec checks
Browse files Browse the repository at this point in the history
  • Loading branch information
McCloudS authored Sep 8, 2024
1 parent 9120d09 commit 6245b0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions subgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6245b0b

Please sign in to comment.