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

-f bestvideo doesn't get the highest quality video for Youtube #22372

Closed
BouncyMaster opened this issue Sep 11, 2019 · 8 comments
Closed

-f bestvideo doesn't get the highest quality video for Youtube #22372

BouncyMaster opened this issue Sep 11, 2019 · 8 comments

Comments

@BouncyMaster
Copy link

@BouncyMaster BouncyMaster commented Sep 11, 2019

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2019.09.12
  • 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 issues including closed ones

Description

Youtube-dl still sees high resolution videos

[youtube] o3HlyPsf9uo: Downloading webpage
[youtube] o3HlyPsf9uo: Downloading video info webpage
[info] Available formats for o3HlyPsf9uo:
format code  extension  resolution note
249          webm       audio only tiny   54k , opus @ 50k (48000Hz), 5.22MiB
250          webm       audio only tiny   74k , opus @ 70k (48000Hz), 6.69MiB
140          m4a        audio only tiny  131k , m4a_dash container, mp4a.40.2@128k (44100Hz), 13.27MiB
251          webm       audio only tiny  134k , opus @160k (48000Hz), 12.67MiB
278          webm       256x128    144p   86k , webm container, vp9, 30fps, video only, 8.17MiB
160          mp4        256x128    144p   99k , avc1.4d400c, 30fps, video only, 6.47MiB
244          webm       854x428    480p  676k , vp9, 30fps, video only, 52.28MiB
135          mp4        854x428    480p  866k , avc1.4d401f, 30fps, video only, 55.93MiB
248          webm       1920x960   1080p 2365k , vp9, 30fps, video only, 185.21MiB
137          mp4        1920x960   1080p 2569k , avc1.640028, 30fps, video only, 167.24MiB
271          webm       2560x1280  1440p 6910k , vp9, 30fps, video only, 413.82MiB
313          webm       3840x1920  2160p 15608k , vp9, 30fps, video only, 1.21GiB
133          mp4        426x214    240p  197k , avc1.4d400d, 30fps, video only, 12.12MiB
242          webm       426x214    240p  199k , vp9, 30fps, video only, 16.91MiB
243          webm       640x320    360p  365k , vp9, 30fps, video only, 29.90MiB
134          mp4        640x320    360p  443k , avc1.4d401e, 30fps, video only, 27.99MiB
247          webm       1280x640   720p 1346k , vp9, 30fps, video only, 105.09MiB
136          mp4        1280x640   720p 1521k , avc1.4d401f, 30fps, video only, 98.69MiB
18           mp4        640x320    360p  539k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 55.29MiB
43           webm       640x360    360p 2147483k , vp8.0, vorbis@128k, 76.87MiB
22           mp4        1280x640   720p 1693k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)

But when using -f bestvideo it downloads the (best) option instead.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Building the Ultimate Mac Pro - Pt 1-o3HlyPsf9uo.mp4':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6avc1mp41
    creation_time   : 2019-09-10T07:38:34.000000Z
  Duration: 00:14:19.59, start: 0.000000, bitrate: 963 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x640 [SAR 1:1 DAR 2:1], 5 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-09-10T07:38:34.000000Z
      handler_name    : ISO Media file produced by Google Inc.

The bug is probably something in the latest tempfix.

@TeddyBearX
Copy link

@TeddyBearX TeddyBearX commented Sep 11, 2019

Specifying using the format codes (eg. -f 313+251) works, but it otherwise defaults to 720p.

@BouncyMaster
Copy link
Author

@BouncyMaster BouncyMaster commented Sep 11, 2019

Specifying using the format codes (eg. -f 313+251) works, but it otherwise defaults to 720p.

Yes i know that i can do that but i need a permanent solution to this.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 11, 2019

All mentioned cases are considered correct, format with higher bitrate is preferred.

@h1nk
Copy link

@h1nk h1nk commented Sep 27, 2019

Is there a way to select the format with the highest resolution and then the highest framerate and then lastly the highest bitrate? bestvideo isn't sufficient for me because on multiple occasions it has selected a lower quality blurry 720p video stream that had slightly higher bitrate than the better quality 1080p format available.

Currently I'm having to resort to stuff like: youtube-dl --format "$(python3 -c 'widths = {7680, 3840, 2560, 1920, 1280, 854, 640, 426, 256}; print('/'.join(f'bestvideo[ext=mp4,width>={w}]+bestaudio[ext=m4a]/bestvideo[ext=webm,width>={w}]+bestaudio[ext=m4a]' for w in sorted(widths, reverse=True)))')"

@MerkaST
Copy link

@MerkaST MerkaST commented Oct 1, 2019

How is bitrate determined? When downloading https://www.youtube.com/watch?v=wzFQJUzoUvM , bestvideo+bestaudio gave me 136+251 at 1280x534, which ffprobe tells me to have a bitrate of 604 kb/s, while the clearly less blurry 1920x800 versions 137+251 and 248+251 that I downloaded for comparison are at 904 kb/s and 777 kb/s respectively (with the latter, which is vp9, being subjectively even less blurry in the two shots I compared despite the lower bitrate).

@reallyuniquename
Copy link

@reallyuniquename reallyuniquename commented Dec 5, 2019

@h1nk
Have you come up with more neat solution?

I'm struggling to build a format string that would always select higher resolution+fps video over higher bitrate video.

Maybe there is a way to override bestvideo/best logic to "sort" videos by resolution and framerate instead of bitrate?

@DerekRead
Copy link

@DerekRead DerekRead commented Dec 21, 2019

Maybe there's some way to use "parse_resolution" and compare the value for that to a specified >= value? Or am I way off here?

@Witchilich
Copy link

@Witchilich Witchilich commented Dec 27, 2019

I just use this. It works
-f bestvideo[height>2160]+bestaudio[acodec=opus]/(bestvideo[height=2160][fps>30]+251)/bestvideo[height=2160]+251/bestvideo[height=2160]+140/(bestvideo[height=1440][fps>30]+251)/bestvideo[height=1440]+251/bestvideo[height=1440]+140/(bestvideo[height=1080][fps>30]+251)/bestvideo[height=1080]+251/bestvideo[height=1080]+140/(bestvideo[height=720][fps>30]+251)/bestvideo+251/bestvideo+bestaudio/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
8 participants
You can’t perform that action at this time.