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

Youtube VP9 format found with incorrect bitrate, causes 'bestvideo' choice to be wrong #6796

Closed
wmwdld opened this issue Sep 8, 2015 · 2 comments

Comments

@wmwdld
Copy link

@wmwdld wmwdld commented Sep 8, 2015

Given:

$ youtube-dl -vF https://www.youtube.com/watch?v=wRjEBYuSg8o
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-vF', 'https://www.youtube.com/watch?v=wRjEBYuSg8o']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2015.09.03
[debug] Python version 3.4.3 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-70767-gd24af70, ffprobe N-70767-gd24af70, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] wRjEBYuSg8o: Downloading webpage
[youtube] wRjEBYuSg8o: Downloading video info webpage
[youtube] wRjEBYuSg8o: Extracting video information
[youtube] wRjEBYuSg8o: Downloading DASH manifest
[youtube] wRjEBYuSg8o: Downloading DASH manifest
[info] Available formats for wRjEBYuSg8o:
format code  extension  resolution note
140          m4a        audio only DASH audio  129k , m4a_dash container, aac  @128k (44100Hz), 23.17MiB
171          webm       audio only DASH audio  135k , vorbis@128k (44100Hz), 16.51MiB
141          m4a        audio only DASH audio  257k , m4a_dash container, aac  @256k (44100Hz), 46.52MiB
160          mp4        256x144    DASH video  126k , avc1.4d400c, 15fps, video only, 20.46MiB
278          webm       256x144    DASH video  132k , webm container, vp9, 1fps, video only, 14.28MiB
242          webm       426x240    DASH video  287k , vp9, 1fps, video only, 28.23MiB
133          mp4        426x240    DASH video  341k , avc1.4d4015, 30fps, video only, 44.81MiB
243          webm       640x360    DASH video  569k , vp9, 1fps, video only, 53.93MiB
134          mp4        640x360    DASH video  619k , avc1.4d401e, 30fps, video only, 70.07MiB
244          webm       854x480    DASH video  936k , vp9, 1fps, video only, 99.39MiB
135          mp4        854x480    DASH video 1149k , avc1.4d401f, 30fps, video only, 136.68MiB
136          mp4        1280x720   DASH video 2293k , avc1.4d401f, 30fps, video only, 279.76MiB
247          webm       1280x720   DASH video 3630k , vp9, 1fps, video only, 209.67MiB
13           3gp        unknown    small
17           3gp        176x144    small ,  mp4a.40.2, mp4v.20.3
36           3gp        320x240    small ,  mp4a.40.2, mp4v.20.3
5            flv        400x240    small
43           webm       640x360    medium ,  vorbis, vp8.0
18           mp4        640x360    medium ,  mp4a.40.2, avc1.42001E
22           mp4        1280x720   hd720 ,  mp4a.40.2, avc1.64001F (best)

Youtube-dl thinks that format 247 is the highest quality format and will choose to download it over formnat 136 (given that ffmpeg is in the path and it's looking to satisfy bestvideo+bestaudio), but this is incorrect as the format 136 stream has a higher bitrate. And in fact both bitrates are wrong; this video has a duration of 1530 seconds, so the fmt 247 stream has a bitrate of 1149 kbit/s and the fmt 136 stream has a bitrate of 1533 kbit/s. I notice that it lists the bitrate of the fmt 135 stream as 1149 kbit/s, so I suspect there could be a parsing error somewhere.

This seems random and unpredictable. The above video was the first in a series. Here is the second video of the series, uploaded by the same user (presumably with the same settings, resolution, bitrate, etc.) just two days later:

$ youtube-dl -vF https://www.youtube.com/watch?v=9TUsPJpTna8
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-vF', 'https://www.youtube.com/watch?v=9TUsPJpTna8']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2015.09.03
[debug] Python version 3.4.3 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-70767-gd24af70, ffprobe N-70767-gd24af70, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] 9TUsPJpTna8: Downloading webpage
[youtube] 9TUsPJpTna8: Downloading video info webpage
[youtube] 9TUsPJpTna8: Extracting video information
[youtube] 9TUsPJpTna8: Downloading DASH manifest
[youtube] 9TUsPJpTna8: Downloading DASH manifest
[info] Available formats for 9TUsPJpTna8:
format code  extension  resolution note
140          m4a        audio only DASH audio  129k , m4a_dash container, aac  @128k (44100Hz), 27.66MiB
171          webm       audio only DASH audio  134k , vorbis@128k (44100Hz), 19.62MiB
141          m4a        audio only DASH audio  257k , m4a_dash container, aac  @256k (44100Hz), 55.53MiB
160          mp4        256x144    DASH video  121k , avc1.4d400c, 15fps, video only, 24.39MiB
278          webm       256x144    DASH video  166k , webm container, vp9, 1fps, video only, 17.10MiB
242          webm       426x240    DASH video  237k , vp9, 1fps, video only, 33.46MiB
133          mp4        426x240    DASH video  269k , avc1.4d4015, 30fps, video only, 53.41MiB
243          webm       640x360    DASH video  459k , vp9, 1fps, video only, 63.60MiB
134          mp4        640x360    DASH video  628k , avc1.4d401e, 30fps, video only, 70.32MiB
244          webm       854x480    DASH video  805k , vp9, 1fps, video only, 116.96MiB
135          mp4        854x480    DASH video 1149k , avc1.4d401f, 30fps, video only, 138.19MiB
247          webm       1280x720   DASH video 1917k , vp9, 1fps, video only, 239.89MiB
136          mp4        1280x720   DASH video 2220k , avc1.4d401f, 30fps, video only, 289.14MiB
13           3gp        unknown    small
17           3gp        176x144    small ,  mp4a.40.2, mp4v.20.3
36           3gp        320x240    small ,  mp4a.40.2, mp4v.20.3
5            flv        400x240    small
43           webm       640x360    medium ,  vorbis, vp8.0
18           mp4        640x360    medium ,  mp4a.40.2, avc1.42001E
22           mp4        1280x720   hd720 ,  mp4a.40.2, avc1.64001F (best)

This time youtube-dl will correctly choose fmt 136 over fmt 247, but only by accident, because the fmt 136 stream really has a bitrate of 1328 kbit/s, not 2220 kbit/s as reported.

The fps values are also consistently wrong for the VP9 formats.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 8, 2015

Bitrate is taken from DASH manifest that is often incorrect. youtube-dl can't do anything about that.

@dstftw dstftw closed this Sep 8, 2015
@wmwdld
Copy link
Author

@wmwdld wmwdld commented Sep 8, 2015

You can do something about it  — you can ignore the bitrate listed and calculate it from the size and duration, both of which you have. The duration is in the manifest as the mediaPresentationDuration attribute of the <MPD> element, and the file size is in the yt:contentLength attribute of the <BaseURL> element (which you already must parse since it's printed in the table above.)

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
2 participants
You can’t perform that action at this time.