Skip to content

Show an estimated size for HLS formats in the video dropdown - #146

Merged
prekabreki merged 1 commit into
mainfrom
fix/144-hls-size-estimate
Dec 4, 2026
Merged

prekabreki merged 1 commit into
mainfrom
fix/144-hls-size-estimate

Conversation

@prekabreki

Copy link
Copy Markdown
Owner

What

HLS (m3u8) video formats have no filesize, so the dropdown showed [617] 1080p60 ~7546k next to [303] 1080p60 ~3191k (40.7GB). The HLS row looked smaller, though it is more than twice the bitrate.

_get_formats() now estimates the size from tbr × duration (as yt-dlp -F does) and labels it (~96.3GB).

Safety

The estimate goes into the label only. filesize stays 0 for estimated formats, because the UI sends it as expected_size, which drives the 85% download-completeness check. A test pins both.

Caveat seen in practice

For the 30 h test video, yt-dlp's tbr gave ~96 GiB but the real download is tracking ~45 GB. The ~ marks it as an upper-bound guess, not a promise.

Verify

  • .venv/Scripts/python.exe -m unittest discover -s tests → 382 tests OK
  • Mutation: disabling the estimate branch fails test_hls_format_without_size_gets_an_estimated_label_only.

Closes #144

HLS (m3u8) formats carry no filesize, so their rows showed only a bitrate and looked smaller than the direct-file rows. Estimate the size from tbr x duration, as yt-dlp -F does, and mark it with ~. The estimate goes into the label only: filesize stays 0 because it becomes expected_size and drives the 85% completeness check.

Closes #144

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prekabreki
prekabreki merged commit 6e9e995 into main Dec 4, 2026
8 checks passed
@prekabreki
prekabreki deleted the fix/144-hls-size-estimate branch December 4, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show an estimated size for HLS formats in the video dropdown

1 participant