From 3ee554401ab2ba6011db408dc6afa47cf99c342e Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 10 Feb 2026 08:34:54 -0700 Subject: [PATCH] feat(HLS): improve audio codec handling with error handling for codec extraction --- unshackle/core/manifests/hls.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/unshackle/core/manifests/hls.py b/unshackle/core/manifests/hls.py index ca7dc5d..122b85c 100644 --- a/unshackle/core/manifests/hls.py +++ b/unshackle/core/manifests/hls.py @@ -116,9 +116,14 @@ class HLS: for playlist in self.manifest.playlists: audio_group = playlist.stream_info.audio - if audio_group: - audio_codec = Audio.Codec.from_codecs(playlist.stream_info.codecs) - audio_codecs_by_group_id[audio_group] = audio_codec + audio_codec: Optional[Audio.Codec] = None + if audio_group and playlist.stream_info.codecs: + try: + audio_codec = Audio.Codec.from_codecs(playlist.stream_info.codecs) + except ValueError: + audio_codec = None + if audio_codec: + audio_codecs_by_group_id[audio_group] = audio_codec try: # TODO: Any better way to figure out the primary track type?