Skip to content

Commit

Permalink
[downloader/hls] Fix incorrect end byte in Range HTTP header for medi…
Browse files Browse the repository at this point in the history
…a segments with EXT-X-BYTERANGE (#24512) (closes #14748)

The end of the byte range is the first byte that is NOT part of the to
be downloaded range. So don't include it into the requested HTTP
download range, as this additional byte leads to a broken TS packet and
subsequently to e.g. visible video corruption.

Fixes #14748.
  • Loading branch information
Stefan Pöschel authored and GitHub committed Sep 17, 2020
1 parent f8c7bed commit 6e65a2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion youtube_dl/downloader/hls.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def is_ad_fragment_end(s):
count = 0
headers = info_dict.get('http_headers', {})
if byte_range:
headers['Range'] = 'bytes=%d-%d' % (byte_range['start'], byte_range['end'])
headers['Range'] = 'bytes=%d-%d' % (byte_range['start'], byte_range['end'] - 1)
while count <= fragment_retries:
try:
success, frag_content = self._download_fragment(
Expand Down

0 comments on commit 6e65a2a

Please sign in to comment.