Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain youtube videos report incorrect bitrates in the DASH manifest #6177

Closed
TheRyuu opened this issue Jul 8, 2015 · 5 comments
Closed

Certain youtube videos report incorrect bitrates in the DASH manifest #6177

TheRyuu opened this issue Jul 8, 2015 · 5 comments

Comments

@TheRyuu
Copy link

@TheRyuu TheRyuu commented Jul 8, 2015

This causes the "bestvideo" format to download the incorrect file since it appears to base it off of bitrate instead of file size. I have not actually visually compared the two but vp9 with a smaller bitrate is almost never going to win vs h264. Even if bit rates were identical the h264 format encoded videos will almost always be of a higher quality than vp9. I assume this is not actually the fault of youtube-dl but instead that the DASH manifest is wrong/lying.

Here's an example:

youtube-dl.exe -v --list-formats https://www.youtube.com/watch?v=Xoz9l_0ssL0
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'--list-formats', u'https://www.youtube.com/watch?v=Xoz9l_0ssL0']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2015.07.07
[debug] Python version 2.7.8 - Windows-8-6.2.9200
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] Xoz9l_0ssL0: Downloading webpage
[youtube] Xoz9l_0ssL0: Downloading video info webpage
[youtube] Xoz9l_0ssL0: Extracting video information
[youtube] Xoz9l_0ssL0: Downloading DASH manifest
[youtube] Xoz9l_0ssL0: Downloading DASH manifest
[info] Available formats for Xoz9l_0ssL0:
format code  extension  resolution note
171          webm       audio only DASH audio  121k , vorbis@128k (44100Hz), 5.75MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, aac  @128k (44100Hz), 6.46MiB
278          webm       256x144    DASH video  108k , webm container, VP9, 15fps, video only, 4.74MiB
160          mp4        256x144    DASH video  111k , avc1.42c00c, 15fps, video only, 5.54MiB
133          mp4        426x240    DASH video  251k , avc1.4d4015, 30fps, video only, 12.45MiB
242          webm       426x240    DASH video  266k , vp9, 30fps, video only, 11.56MiB
243          webm       640x360    DASH video  535k , vp9, 30fps, video only, 22.02MiB
134          mp4        640x360    DASH video  619k , avc1.4d401e, 30fps, video only, 29.53MiB
244          webm       854x480    DASH video  971k , vp9, 30fps, video only, 39.58MiB
135          mp4        854x480    DASH video 1111k , avc1.4d401f, 30fps, video only, 54.60MiB
247          webm       1280x720   DASH video 2047k , vp9, 30fps, video only, 80.88MiB
136          mp4        1280x720   DASH video 2222k , avc1.4d401f, 30fps, video only, 108.44MiB
298          mp4        1280x720   DASH video 3351k , h264, 60fps, video only, 159.74MiB
302          webm       1280x720   DASH video 3424k , VP9, 60fps, video only, 137.86MiB
248          webm       1920x1080  DASH video 3631k , vp9, 30fps, video only, 144.58MiB
137          mp4        1920x1080  DASH video 4218k , avc1.640028, 30fps, video only, 204.34MiB
299          mp4        1920x1080  DASH video 5530k , h264, 60fps, video only, 274.20MiB
303          webm       1920x1080  DASH video 6140k , VP9, 60fps, video only, 239.56MiB
17           3gp        176x144
36           3gp        320x240
5            flv        400x240
43           webm       640x360
18           mp4        640x360
22           mp4        1280x720   (best)

And the offending lines:

299          mp4        1920x1080  DASH video 5530k , h264, 60fps, video only, 274.20MiB
303          webm       1920x1080  DASH video 6140k , VP9, 60fps, video only, 239.56MiB

The video is 427 seconds long (7:07) if you want to do the math. The actual bitrate of the webm video in this case (for format 303) is 4501 kbps. I'm not sure why the DASH manifest reports it this way but the VP9 video in this case is almost certainly lower quality than the h264 one.

There are probably several ways to fix it (if it's deemed nessasary). I'm not sure if you want to entirely base it off of file size or a combination of bitrate and file size. In any case there should be a bias towards h264 as I'm unaware of VP9 offering any benifits other than it being a "free format" and is almost certainly going to be at a lower bitrate than h264.

Edit: Another video which shows this same behavoir is https://www.youtube.com/watch?v=9STtshhf9zc (by the same creator).

@RSully
Copy link

@RSully RSully commented Jul 8, 2015

Having the same problem with audio I think:

140          m4a        audio only DASH audio  128k , m4a_dash container, aac  @128k (44100Hz), 7.59MiB
171          webm       audio only DASH audio  135k , vorbis@128k (44100Hz), 6.10MiB

It uses 171 and forces mkv container instead of using 140.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jul 8, 2015

In any case there should be a bias towards h264 as I'm unaware of VP9

Rather selfish.
You can however use -f bestvideo[ext!=webm]+bestaudio[ext!=webm]/best[ext!=webm] to drop webm completely.

almost certainly going to be at a lower bitrate than h264

By the way bitrate is not necessarily the measure of quality as well as filesize, see #6018 (comment).
Closing since youtube-dl can do nothing about invalid data in DASH manifests.

@dstftw dstftw closed this Jul 8, 2015
@nevubm
Copy link

@nevubm nevubm commented Dec 5, 2015

Since bitrate reported in the DASH manifest is often incorrect, would it not make sense to ignore it and prioritize based on total size instead? I think it's safe to assume the duration will be constant at all quality levels.

@TheRyuu
Copy link
Author

@TheRyuu TheRyuu commented Dec 12, 2015

That wouldn't work because vp9 is almost always going to be preferred over h264. I was incorrect in my original statement. After much experimentation vp9 almost always turns out to be the better of the two even with the smaller file size. vp9 should therefore probably be the preferred format even if it's smaller or has a lower bitrate.

@nevubm
Copy link

@nevubm nevubm commented Dec 12, 2015

That may be true, but that's a separate issue. My point is since DASH manifest is reporting unreliable bitrates, it would be futile to use this value in any meaningful way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.