fix audio codec

This commit is contained in:
Sihht 2025-04-17 10:54:12 -05:00 committed by GitHub
parent 31e81432e3
commit 16f267052d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -892,6 +892,7 @@ class MenuTrack:
class Tracks:
AUDIO_CODEC_MAP = {"EC3": "ec-3", "AAC": "mp4a"}
"""
Tracks.
Stores video, audio, and subtitle tracks. It also stores chapter/menu entries.
@ -1190,7 +1191,7 @@ class Tracks:
if not with_descriptive:
self.audios = [x for x in self.audios if not x.descriptive]
if by_codec:
codec_audio = list(filter(lambda x: any(y for y in self.AUDIO_CODEC_MAP[by_codec] if y in x.codec), self.audio))
codec_audio = list(filter(lambda x: any(y for y in self.AUDIO_CODEC_MAP[by_codec] if y in x.codec), self.audios))
if not codec_audio and not should_fallback:
raise ValueError(f"There's no {by_codec} audio tracks. Aborting.")
else: