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

Default settings do not download best quality video from YouTube #8749

Closed
FrostedMint opened this issue Mar 4, 2016 · 2 comments
Closed

Default settings do not download best quality video from YouTube #8749

FrostedMint opened this issue Mar 4, 2016 · 2 comments

Comments

@FrostedMint
Copy link

@FrostedMint FrostedMint commented Mar 4, 2016

It appears that the default quality settings are not always grabbing the best possible video from YouTube.

Here is a selection of formats reported using -F for this music video:

251          webm       audio only DASH audio  165k , opus @160k, 4.74MiB
136          mp4        1280x720   720p 2218k , avc1.4d401f, 30fps, video only, 63.58MiB
247          webm       1280x720   720p 2382k , vp9, 30fps, video only, 46.77MiB
22           mp4        1280x720   hd720 , avc1.64001F,  mp4a.40.2@192k (best)

And here is what actually gets downloaded and muxed:

Format Container Size Video Audio
247+251 WebM 52 MB VP9 @ 1454 Kbps Opus @ 154 Kbps
136+251 Matroska 69 MB AVC1 @ ~2060 Kbps Opus @ 154 Kbps
22 MP4 88 MB AVC1 @ 2663 Kbps AAC @ 192 Kbps

I would expect 22 to be the best possible format, and 136+251 to be the best possible DASH format. Instead, I get 247+251.

I'm using MediaInfo on OS X to determine the bitrates.

Here's the full output of youtube-dl:

$ uname -v
Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64

$ youtube-dl -U
youtube-dl is up-to-date (2016.03.01)

$ export VIDEO=https://www.youtube.com/watch?v=keeYY_5XR4w

$ youtube-dl --ignore-config -vF $VIDEO
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--ignore-config', u'-vF', u'https://www.youtube.com/watch?v=keeYY_5XR4w']
[debug] Encodings: locale UTF-8, fs utf-8, out None, pref UTF-8
[debug] youtube-dl version 2016.03.01
[debug] Python version 2.7.10 - Darwin-15.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.0, ffprobe 3.0, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] keeYY_5XR4w: Downloading webpage
[youtube] keeYY_5XR4w: Downloading video info webpage
[youtube] keeYY_5XR4w: Extracting video information
[youtube] {22} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {43} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {18} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {5} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {36} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {17} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {136} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {247} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {135} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {244} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {134} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {243} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {133} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {242} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {160} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {278} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {140} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {171} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {249} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {250} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {251} signature length 40.44, html5 player en_US-vfl_cdzrt
[info] Available formats for keeYY_5XR4w:
format code  extension  resolution note
249          webm       audio only DASH audio   50k , opus @ 50k, 1.47MiB
250          webm       audio only DASH audio   67k , opus @ 70k, 1.91MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, mp4a.40.2@128k, 3.91MiB
171          webm       audio only DASH audio  137k , vorbis@128k, 3.93MiB
251          webm       audio only DASH audio  165k , opus @160k, 4.74MiB
278          webm       256x144    144p   96k , webm container, vp9, 15fps, video only, 2.55MiB
160          mp4        256x144    144p  117k , avc1.42c00c, 15fps, video only, 3.43MiB
242          webm       426x240    240p  257k , vp9, 30fps, video only, 5.97MiB
133          mp4        426x240    240p  262k , avc1.4d4015, 30fps, video only, 7.53MiB
243          webm       640x360    360p  496k , vp9, 30fps, video only, 11.06MiB
134          mp4        640x360    360p  607k , avc1.4d401e, 30fps, video only, 16.49MiB
244          webm       854x480    480p  988k , vp9, 30fps, video only, 20.34MiB
135          mp4        854x480    480p 1110k , avc1.4d401f, 30fps, video only, 31.62MiB
136          mp4        1280x720   720p 2218k , avc1.4d401f, 30fps, video only, 63.58MiB
247          webm       1280x720   720p 2382k , vp9, 30fps, video only, 46.77MiB
36           3gp        320x?      small , mp4v.20.3,  mp4a.40.2
17           3gp        176x144    small , mp4v.20.3,  mp4a.40.2@ 24k
5            flv        400x240    small , h263, mp3  @ 64k
43           webm       640x360    medium , vp8.0,  vorbis@128k
18           mp4        640x360    medium , avc1.42001E,  mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F,  mp4a.40.2@192k (best)

$ youtube-dl --ignore-config -v $VIDEO
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--ignore-config', u'-v', u'https://www.youtube.com/watch?v=keeYY_5XR4w']
[debug] Encodings: locale UTF-8, fs utf-8, out None, pref UTF-8
[debug] youtube-dl version 2016.03.01
[debug] Python version 2.7.10 - Darwin-15.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.0, ffprobe 3.0, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] keeYY_5XR4w: Downloading webpage
[youtube] keeYY_5XR4w: Downloading video info webpage
[youtube] keeYY_5XR4w: Extracting video information
[youtube] {22} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {43} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {18} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {5} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {36} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {17} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {136} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {247} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {135} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {244} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {134} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {243} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {133} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {242} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {160} signature length 38.44, html5 player en_US-vfl_cdzrt
[youtube] keeYY_5XR4w: Downloading player https://s.ytimg.com/yts/jsbin/player-en_US-vfl_cdzrt/base.js
[youtube] {278} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {140} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {171} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {249} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {250} signature length 40.44, html5 player en_US-vfl_cdzrt
[youtube] {251} signature length 40.44, html5 player en_US-vfl_cdzrt
[debug] Invoking downloader on u'https://r19---sn-nx57yn7s.googlevideo.com/videoplayback?sver=3&lmt=1425168130099374&ipbits=0&itag=247&key=yt6&mime=video%2Fwebm&expire=1457085346&mn=sn-nx57yn7s&mm=31&upn=3_RNUWvTAfI&ms=au&mv=m&mt=1457063667&ip=216.243.6.134&fexp=9415516%2C9416126%2C9418183%2C9420052%2C9420452%2C9422596%2C9423038%2C9423661%2C9423662%2C9424416%2C9425398%2C9428063%2C9428247%2C9428329%2C9428559%2C9428965%2C9429693%2C9430989&sparams=clen%2Cdur%2Cgcr%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&keepalive=yes&id=o-AJt0o0a7Uh5-603hE-nngo2BRkWoCFTIKdbMEXlMF_1u&clen=49037308&requiressl=yes&gir=yes&nh=IgpwcjAxLnNlYTAzKgkxMjcuMC4wLjE&pl=22&initcwndbps=4033750&dur=257.824&gcr=us&source=youtube&signature=1BF6FA409837EE061CB4BA964E10E6D30FD50543.B67F7DF27BE51D76480494962EA40EA1E9CAC2F2&ratebypass=yes'
[download] Destination: 【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.f247.webm
[download] 100% of 46.77MiB in 00:02
[debug] Invoking downloader on u'https://r19---sn-nx57yn7s.googlevideo.com/videoplayback?sver=3&lmt=1425167994422249&ipbits=0&itag=251&key=yt6&mime=audio%2Fwebm&expire=1457085346&mn=sn-nx57yn7s&mm=31&upn=3_RNUWvTAfI&ms=au&mv=m&mt=1457063667&ip=216.243.6.134&fexp=9415516%2C9416126%2C9418183%2C9420052%2C9420452%2C9422596%2C9423038%2C9423661%2C9423662%2C9424416%2C9425398%2C9428063%2C9428247%2C9428329%2C9428559%2C9428965%2C9429693%2C9430989&sparams=clen%2Cdur%2Cgcr%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&keepalive=yes&id=o-AJt0o0a7Uh5-603hE-nngo2BRkWoCFTIKdbMEXlMF_1u&clen=4970110&requiressl=yes&gir=yes&nh=IgpwcjAxLnNlYTAzKgkxMjcuMC4wLjE&pl=22&initcwndbps=4033750&dur=257.861&gcr=us&source=youtube&signature=B596A2E8254CEDE00DCC35EFC9F1F1CFB102D0CA.8FE4FA58EAC2FCE4FAE5865E5B376C4642AEC648&ratebypass=yes'
[download] Destination: 【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.f251.webm
[download] 100% of 4.74MiB in 00:00
[ffmpeg] Merging formats into "【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.webm"
[debug] ffmpeg command line: ffmpeg -y -i 'file:【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.f247.webm' -i 'file:【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.temp.webm'
Deleting original file 【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.f247.webm (pass -k to keep)
Deleting original file 【ポリリズム】Perfume×capsule【Sound of Silence】-keeYY_5XR4w.f251.webm (pass -k to keep)
@FrostedMint FrostedMint changed the title Not always grabbing "best" quality video on YouTube Default settings do not download best quality video from YouTube Mar 4, 2016
@FrostedMint
Copy link
Author

@FrostedMint FrostedMint commented Mar 4, 2016

So, one source suggests encoding an x264 video at a quality equivalent to a VP9 video requires about 49% more bitrate. An x264 video stream equivalent to a VP9 video stream at 1454 Kbps would require about ~2166 Kbps, slightly above the actual x264 bitrate of ~2060 Kbps.

Perhaps this explains why -F incorrectly reports the bitrate of the VP9 stream as 2382k (actually 1454 Kbps); compared to the x264 stream, which is reported as having a lower bitrate (2218k) but a 35% larger file.

Even so, isn't the best option still to grab format 22?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 4, 2016

Bitrate for f22 is not known beforehand. Other formats' bitrates are taken from metadata.

@dstftw dstftw closed this Mar 4, 2016
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.