From 5b69cf30191df6941ea0cf0e20f237f3f64740a5 Mon Sep 17 00:00:00 2001 From: Thomas Hebb Date: Tue, 27 May 2025 18:20:16 -0400 Subject: [PATCH] [fd/hls] Suggest `--hls-split-discontinuity` on duplicate init data When discontinuities are merged (the default), well-formed m3u8 files can produce this error. Help the user out by informing them of that. --- yt_dlp/downloader/hls.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.py index 1f36a07f5..828d5f5c9 100644 --- a/yt_dlp/downloader/hls.py +++ b/yt_dlp/downloader/hls.py @@ -227,8 +227,10 @@ def is_ad_fragment_end(s): if format_index and discontinuity_count != format_index: continue if frag_index > 0: - self.report_error( - 'Initialization fragment found after media fragments, unable to download') + msg = 'Initialization fragment found after media fragments, unable to download' + if format_index is None: + msg += '; if due to discontinuities, try --hls-split-discontinuity' + self.report_error(msg) return False frag_index += 1 map_info = parse_m3u8_attributes(line[11:])