Repository: yt-dlp
Issue: [uplynk] inaccurate reporting of available bandwidths
Labels: site-bug,triage

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that a **supported** site is broken
- [X] I've verified that I'm running yt-dlp version **2023.03.04** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [ ] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

worldwide

### Provide a description that is worded well enough to be understood

I know this type of report can get contentious ("just passing on what the site tells us"), but I believe that potential improvements exist here.

Asked (ex-post, actually, to get the debug listing) for available formats as shown in the section below.

First issue: listing assigns entire bitrate to video and displays audio as "0k." I wouldn't display either without some information on the ratio between them.

Actual download of "-f 1282":

`[download] 100% of  214.70MiB in 00:03:57 at 924.59KiB/s`

Almost twice the estimated filesize.

Decided to actually look at the .m3u8 file. For the highest resolution format, I found this:

```
#UPLYNK-MEDIA0:1280x720x30,main-31,2x48000
#EXT-X-STREAM-INF:PROGRAM-ID=1,RESOLUTION=1280x720,BANDWIDTH=2779976,CODECS="mp4a.40.5,avc1.4d001f",FRAME-RATE=30.000,AUDIO="aac",AVERAGE-BANDWIDTH=1282346
https://content-ause1.uplynk.com/5de6f33b5ca144e6958f78d3e183d252/g.m3u8
```

It appears that yt-dlp reports the "AVERAGE-BANDWIDTH," when the "BANDWIDTH" paramenter gives a much better estimation of the actual average bandwidth. From mediainfo:

```
[...]
Duration                                 : 11 min 42 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 464 kb/s
[...]
Video
[...]
Bit rate                                 : 2 372 kb/s
[...]
Audio
[...]
Bit rate                                 : 127 kb/s
```

Note that the  mediainfo numbers come from the file **after** ffmpeg reduced its size by about four percent (225,125,488 bytes to 216,077,985) when converting it from MPEG-TS to MPEG-4. Simply using the "BANDWIDTH" parameter would give an estimated file size of 2779976*702/8 = 243,942,894 bytes (about eight percent larger than the MPEG-TS file). In addition to providing a much more accurate projection of the file size, I believe that yt-dlp should prefer overestimating the size to underestimating it. I have verified that errors of similar magnitudes happen at other resolutions with this video (with lower resolutions having slightly smaller estimation errors, but they also reduce more when converted from MPEG-TS).

I understand that you wouldn't want to rush and change the calculation based on just this one report, but perhaps other users can offer their experiences to verify that this happens generally with this extractor.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['--restrict-filenames', '-o', '%(title)s-%(id)s-%(uploader)s.%(ext)s', '-w', '-F', '-v', 'https://content.uplynk.com/5de6f33b5ca144e6958f78d3e183d252.m3u8']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d]
[debug] Python 3.11.3 (CPython x86_64 64bit) - Linux-5.15.88-with-glibc2.36 (OpenSSL 1.1.1t  7 Feb 2023, glibc 2.36)
[debug] exe versions: ffmpeg 4.4.3 (setts), ffprobe 4.4.3
[debug] Optional libraries: certifi-3021.03.16, pycrypto-3.17
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[uplynk] Extracting URL: https://content.uplynk.com/5de6f33b5ca144e6958f78d3e183d252.m3u8
[uplynk] 5de6f33b5ca144e6958f78d3e183d252: Downloading m3u8 information
[uplynk] 5de6f33b5ca144e6958f78d3e183d252: Downloading JSON metadata
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[info] Available formats for 5de6f33b5ca144e6958f78d3e183d252:
ID   EXT RESOLUTION FPS │   FILESIZE   TBR PROTO │ VCODEC        VBR ACODEC    ABR
──────────────────────────────────────────────────────────────────────────────────
59   mp4 192x108     15 │ ~  5.12MiB   60k m3u8  │ avc1.42000b   60k mp4a.40.5  0k
116  mp4 256x144     30 │ ~  9.97MiB  116k m3u8  │ avc1.42000c  116k mp4a.40.5  0k
208  mp4 416x234     30 │ ~ 17.87MiB  208k m3u8  │ avc1.42000d  208k mp4a.40.5  0k
354  mp4 704x396     30 │ ~ 30.42MiB  355k m3u8  │ avc1.4d001e  355k mp4a.40.5  0k
616  mp4 896x504     30 │ ~ 52.86MiB  616k m3u8  │ avc1.4d001f  616k mp4a.40.5  0k
1282 mp4 1280x720    30 │ ~110.02MiB 1282k m3u8  │ avc1.4d001f 1282k mp4a.40.5  0k
```