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

bestvideo doesn’t always pick the highest frame rate #21401

Closed
danielyli opened this issue Jun 15, 2019 · 7 comments
Closed

bestvideo doesn’t always pick the highest frame rate #21401

danielyli opened this issue Jun 15, 2019 · 7 comments

Comments

@danielyli
Copy link

@danielyli danielyli commented Jun 15, 2019

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2019.06.08
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Description with Verbose log

For some videos, the bestvideo format selector doesn’t select the highest frame rate.

For example, the video at https://www.youtube.com/watch?v=0pMfYXlHZw0 has a 1080p60 format, yet selecting bestvideo+bestaudio selects the 1080p 30 fps version:

$ youtube-dl -F 'https://www.youtube.com/watch?v=0pMfYXlHZw0'
[youtube] 0pMfYXlHZw0: Downloading webpage
[youtube] 0pMfYXlHZw0: Downloading video info webpage
[info] Available formats for 0pMfYXlHZw0:
format code  extension  resolution note
249          webm       audio only DASH audio   63k , opus @ 50k, 45.19MiB
250          webm       audio only DASH audio   83k , opus @ 70k, 59.85MiB
171          webm       audio only DASH audio  122k , vorbis@128k, 96.79MiB
140          m4a        audio only DASH audio  137k , m4a_dash container, mp4a.40.2@128k, 117.99MiB
251          webm       audio only DASH audio  160k , opus @160k, 118.52MiB
160          mp4        256x144    144p  119k , avc1.4d400c, 30fps, video only, 23.29MiB
278          webm       256x144    144p  152k , webm container, vp9, 30fps, video only, 56.59MiB
133          mp4        426x240    240p  198k , avc1.4d4015, 30fps, video only, 36.29MiB
242          webm       426x240    240p  222k , vp9, 30fps, video only, 61.54MiB
243          webm       640x360    360p  422k , vp9, 30fps, video only, 112.23MiB
134          mp4        640x360    360p  493k , avc1.4d401e, 30fps, video only, 72.92MiB
244          webm       854x480    480p  754k , vp9, 30fps, video only, 184.54MiB
135          mp4        854x480    480p  783k , avc1.4d401f, 30fps, video only, 120.97MiB
247          webm       1280x720   720p 1520k , vp9, 30fps, video only, 568.34MiB
298          mp4        1280x720   720p60 1867k , avc1.4d4020, 60fps, video only, 277.61MiB
302          webm       1280x720   720p60 2657k , vp9, 60fps, video only, 542.43MiB
248          webm       1920x1080  1080p 2746k , vp9, 30fps, video only, 1.09GiB
303          webm       1920x1080  1080p60 4426k , vp9, 60fps, video only, 1.71GiB
299          mp4        1920x1080  1080p60 5811k , avc1.64002a, 60fps, video only, 1.19GiB
136          mp4        1280x720   720p 5881k , avc1.4d401f, 30fps, video only, 571.48MiB
137          mp4        1920x1080  1080p 10836k , avc1.640028, 30fps, video only, 1.08GiB
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k, 336.54MiB
43           webm       640x360    medium , vp8.0, vorbis@128k, 404.88MiB
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)
$ youtube-dl -v -f 'bestvideo+bestaudio' 'https://www.youtube.com/watch?v=0pMfYXlHZw0'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-f', u'bestvideo+bestaudio', u'https://www.youtube.com/watch?v=0pMfYXlHZw0']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.06.08
[debug] Python version 2.7.16 (CPython) - Darwin-18.6.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.1.3, ffprobe 4.1.3, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] 0pMfYXlHZw0: Downloading webpage
[youtube] 0pMfYXlHZw0: Downloading video info webpage
[youtube] {22} signature length 105, html5 player vflzbi_R5
[youtube] {43} signature length 101, html5 player vflzbi_R5
[youtube] {18} signature length 101, html5 player vflzbi_R5
[youtube] {137} signature length 101, html5 player vflzbi_R5
[youtube] {248} signature length 105, html5 player vflzbi_R5
[youtube] {299} signature length 105, html5 player vflzbi_R5
[youtube] {303} signature length 105, html5 player vflzbi_R5
[youtube] {136} signature length 101, html5 player vflzbi_R5
[youtube] {247} signature length 105, html5 player vflzbi_R5
[youtube] {298} signature length 105, html5 player vflzbi_R5
[youtube] {302} signature length 101, html5 player vflzbi_R5
[youtube] {135} signature length 105, html5 player vflzbi_R5
[youtube] {244} signature length 105, html5 player vflzbi_R5
[youtube] {134} signature length 105, html5 player vflzbi_R5
[youtube] {243} signature length 105, html5 player vflzbi_R5
[youtube] {133} signature length 105, html5 player vflzbi_R5
[youtube] {242} signature length 105, html5 player vflzbi_R5
[youtube] {160} signature length 105, html5 player vflzbi_R5
[youtube] {278} signature length 101, html5 player vflzbi_R5
[youtube] {140} signature length 105, html5 player vflzbi_R5
[youtube] {171} signature length 105, html5 player vflzbi_R5
[youtube] {249} signature length 101, html5 player vflzbi_R5
[youtube] {250} signature length 101, html5 player vflzbi_R5
[youtube] {251} signature length 105, html5 player vflzbi_R5
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on u'https://r5---sn-nx57ynls.googlevideo.com/videoplayback?expire=1560609752&ei=eK8EXezzAcuLkwbVoLrYAQ&ip=104.143.92.81&id=o-ABRmUIRQxwsHuC0Okd3BJjUIN9db_xpRjiewck8FqMFn&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C298%2C299%2C302%2C303&source=youtube&requiressl=yes&mm=31&mn=sn-nx57ynls&ms=au&mv=m&pl=27&gcr=us&initcwndbps=967500&mime=video%2Fmp4&gir=yes&clen=1161467514&dur=7644.665&lmt=1559229307168579&mt=1560588064&keepalive=yes&c=WEB&txp=5535432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cgcr%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgFxwcb0TzD3AT_sCbkJbsEgx0RR4RGHrX6XMBEMH8JRECIQDDG9rn9uIBsWbnRajvdch_Cl9gL-_EzeGtK4mkUgcEAw%3D%3D&sig=ALgxI2wwRAIgZ2T_9_tfAV17dCnBZPGd-5OnSRbOSKX3neW3uS0wZqgCIAggla7DH3PQ0z6b60vW_l2MA3UUuG0iu_s1fb-Gt60f&ratebypass=yes'
[download] Resuming download at byte 68346204
[download] Destination: SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.f137.mp4
[download] 100% of 1.08GiB in 01:49
[debug] Invoking downloader on u'https://r5---sn-nx57ynls.googlevideo.com/videoplayback?expire=1560609752&ei=eK8EXezzAcuLkwbVoLrYAQ&ip=104.143.92.81&id=o-ABRmUIRQxwsHuC0Okd3BJjUIN9db_xpRjiewck8FqMFn&itag=251&source=youtube&requiressl=yes&mm=31&mn=sn-nx57ynls&ms=au&mv=m&pl=27&gcr=us&initcwndbps=967500&mime=audio%2Fwebm&gir=yes&clen=124277799&dur=7644.721&lmt=1559224894305066&mt=1560588064&keepalive=yes&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgFxwcb0TzD3AT_sCbkJbsEgx0RR4RGHrX6XMBEMH8JRECIQDDG9rn9uIBsWbnRajvdch_Cl9gL-_EzeGtK4mkUgcEAw%3D%3D&sig=ALgxI2wwRgIhAP_cTlVWTGd6b8Vax3w_j-pEbKlcWMq6wRWPDovZwobGAiEAvVGkm68mSjx6ZHR-h3yIkV14UuqQVY7BOHRlimQ_U8Q=&ratebypass=yes'
[download] Destination: SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.f251.webm
[download] 100% of 118.52MiB in 00:15
[ffmpeg] Merging formats into "SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.f137.mp4' -i 'file:SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.f251.webm' -c copy -map '0:v:0' -map '1:a:0' 'file:SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.temp.mkv'
Deleting original file SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.f137.mp4 (pass -k to keep)
Deleting original file SpaceEngine  - 0.990 Pre-release Stream #1-0pMfYXlHZw0.f251.webm (pass -k to keep)
@bitraid
Copy link
Contributor

@bitraid bitraid commented Jun 15, 2019

bestvideo selects the highest bitrate.

@dstftw dstftw closed this Jun 15, 2019
@danielyli
Copy link
Author

@danielyli danielyli commented Jun 16, 2019

Thank you for the explanation!

@SebiderSushi
Copy link

@SebiderSushi SebiderSushi commented Jun 29, 2019

But how could a video with a lower bitrate possibly result in a higher filesize?

299 mp4 1920x1080 1080p60 5811k , avc1.64002a, 60fps, video only, 1.19GiB
137 mp4 1920x1080 1080p 10836k , avc1.640028, 30fps, video only, 1.08GiB

@bitraid
Copy link
Contributor

@bitraid bitraid commented Jun 29, 2019

Because it has more fps.

@SebiderSushi
Copy link

@SebiderSushi SebiderSushi commented Jun 29, 2019

But if $bitrate_kbps * $duration_second = $filesize_kbit is applicable here then the result could never be larger for a video with same duration but a lower bitrate. So independently of the resulution or framerate of the video the above numbers should either be impossible or i'm misinterpreting the bitrate here. (N.B. i think the 5811k and the 10836k respectively in column 5 refer to the video bitrate in bits per second)

@bitraid
Copy link
Contributor

@bitraid bitraid commented Jun 29, 2019

The reported quality that youtube provides are not the actual bitrate of the files. For example, an opus file with average bitrate of 130kb/s is reportet as 160K. The real bitrate of those videos are 1333kb/s for the 60fps, and 1212kb/s for the 30fps.

@SebiderSushi
Copy link

@SebiderSushi SebiderSushi commented Jun 29, 2019

So do i get this right: youtube-dl uses the quality reported by the site to decide which format would be bestaudio or bestvideo, but in the case of YouTube this is inaccurate or just wrong and in this special case leads youtube-dl to choose a format which is not really the best?

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.