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

[Feature Request] Add more operations to format selection #19241

Open
sgkoishi opened this issue Feb 16, 2019 · 5 comments
Open

[Feature Request] Add more operations to format selection #19241

sgkoishi opened this issue Feb 16, 2019 · 5 comments

Comments

@sgkoishi
Copy link

@sgkoishi sgkoishi commented Feb 16, 2019

  • I've verified and I assure that I'm running youtube-dl 2019.02.08
  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Enhancement of Format Selection

Format selection now allow the best/worst format to download. However, the format selection only support conditions (e.g. -f "best[height>=720]"), as a filter. In some special case, people may want to download video of most/least certain field (e.g. highest resolution, smallest size) rather than default "best/worst". Youtube-dl does not support this without manually specify numeric format code or knowing the exact value.

For example, the best quality for this youtube video is a medium(640x360) resolution while highest resolution is 1080p(1920x1080).

format code  extension  resolution note
249          webm       audio only DASH audio   62k , opus @ 50k, 1.43MiB
250          webm       audio only DASH audio   82k , opus @ 70k, 1.91MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, mp4a.40.2@128k, 3.32MiB
171          webm       audio only DASH audio  144k , vorbis@128k, 3.55MiB
251          webm       audio only DASH audio  159k , opus @160k, 3.77MiB
160          mp4        256x144    144p   51k , avc1.4d400c, 30fps, video only, 501.84KiB
278          webm       256x144    144p   95k , webm container, vp9, 30fps, video only, 1.47MiB
133          mp4        426x240    240p  147k , avc1.4d4015, 30fps, video only, 1.08MiB
242          webm       426x240    240p  169k , vp9, 30fps, video only, 1.59MiB
134          mp4        640x360    360p  304k , avc1.4d401e, 30fps, video only, 2.04MiB
243          webm       640x360    360p  337k , vp9, 30fps, video only, 2.69MiB
135          mp4        854x480    480p  384k , avc1.4d401f, 30fps, video only, 3.10MiB
136          mp4        1280x720   720p  468k , avc1.4d401f, 30fps, video only, 5.18MiB
244          webm       854x480    480p  551k , vp9, 30fps, video only, 3.96MiB
137          mp4    --->1920x1080  1080p  597k , avc1.640028, 30fps, video only, 7.67MiB
247          webm       1280x720   720p  815k , vp9, 30fps, video only, 7.21MiB
248          webm   --->1920x1080  1080p 1064k , vp9, 30fps, video only, 13.02MiB
17           3gp        176x144    small   48k , mp4v.20.3, mp4a.40.2@ 24k (22050Hz), 1.26MiB
36           3gp        320x180    small  156k , mp4v.20.3, mp4a.40.2 (22050Hz), 4.08MiB
18           mp4    --->640x360    medium  361k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 9.44MiB (best)

If I want to download the highest resolution of this video, I had to manually specify 1080p or an extractor specific code(137, 248) now.

Requested new feature: add more operations of format selection.
Sample: To find highest resolution, use -f "best[height]" or -f "best[height=max]"

@sgkoishi sgkoishi changed the title [Feature Request] format [Feature Request] Add more operations to format selection Feb 16, 2019
@JensKorte
Copy link

@JensKorte JensKorte commented Feb 19, 2019

At the moment it is not possible to request the smallestFilesize. You could use worstvideo+worstaudio as a workaround. I don't know if it is the same as the smallest sum of (smallestVideo+smallestAudio).

I get the best video without any format option (248) for the video mentioned above. Why don't you just use -f bestvideo+bestaudio?

@kurtontheway
Copy link

@kurtontheway kurtontheway commented Feb 19, 2019

Could not get 137+140 with the option "bestvideo+bestaudio"..
youtube-dl -F "https://www.youtube.com/watch?v=XiVeuftm5go&t=4s"

format code extension resolution note
139 m4a audio only DASH audio 52k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 4.58MiB
140 m4a audio only DASH audio 131k , m4a_dash container, mp4a.40.2@128k (44100Hz), 12.22MiB
160 mp4 256x144 DASH video 108k , mp4_dash container, avc1.4d400b, 30fps, video only
133 mp4 426x240 DASH video 242k , mp4_dash container, avc1.4d400c, 30fps, video only
134 mp4 640x360 DASH video 325k , mp4_dash container, avc1.4d401e, 30fps, video only, 5.82MiB
135 mp4 854x480 DASH video 1155k , mp4_dash container, avc1.4d4014, 30fps, video only
137 mp4 1920x1080 DASH video 2197k , mp4_dash container, avc1.640028, 30fps, video only, 45.22MiB
136 mp4 1280x720 DASH video 2310k , mp4_dash container, avc1.4d4016, 30fps, video only
17 3gp 176x144 small 45k , mp4v.20.3, mp4a.40.2@ 24k (22050Hz), 4.39MiB
36 3gp 320x180 small 130k , mp4v.20.3, mp4a.40.2 (22050Hz), 12.57MiB
43 webm 640x360 medium , vp8.0, vorbis@128k, 24.67MiB
18 mp4 640x360 medium 295k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 28.36MiB
22 mp4 1280x720 hd720 947k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)
@JensKorte
Copy link

@JensKorte JensKorte commented Feb 19, 2019

You are right. I checked for "best" and not for bestvideo. I guess bestvideo uses the highest videobitrate which results in 136 with lower resolution, like you wrote.

youtube-dl --get-url -f "bestvideo[height>1000],bestaudio" "https://www.youtube.com/watch?v=XiVeuftm5go&t=4s" # is a workaround
Result: Video: itag/137/ Audio: itag/140

@ChildishGiant
Copy link

@ChildishGiant ChildishGiant commented Jun 23, 2019

image

Here the "best" option is 360p even though there's a 1080p option. Is this still

@inferiorhumanorgans
Copy link

@inferiorhumanorgans inferiorhumanorgans commented May 12, 2020

At the moment it is not possible to request the smallestFilesize. You could use worstvideo+worstaudio as a workaround. I don't know if it is the same as the smallest sum of (smallestVideo+smallestAudio).

$ youtube-dl -F https://youtube.com/watch?v=8ha4bkni3zg
[youtube] 8ha4bkni3zg: Downloading webpage
[info] Available formats for 8ha4bkni3zg:
format code  extension  resolution note
249          webm       audio only tiny   51k , opus @ 50k (48000Hz), 11.78MiB
250          webm       audio only tiny   64k , opus @ 70k (48000Hz), 12.64MiB
251          webm       audio only tiny  117k , opus @160k (48000Hz), 22.86MiB
140          m4a        audio only tiny  132k , m4a_dash container, mp4a.40.2@128k (44100Hz), 30.32MiB
278          webm       256x144    144p   96k , webm container, vp9, 30fps, video only, 20.04MiB
160          mp4        256x144    144p  111k , avc1.4d400c, 30fps, video only, 16.15MiB
242          webm       426x240    240p  193k , vp9, 30fps, video only, 40.96MiB
133          mp4        426x240    240p  245k , avc1.4d4015, 30fps, video only, 35.31MiB
243          webm       640x360    360p  414k , vp9, 30fps, video only, 89.14MiB
134          mp4        640x360    360p  505k , avc1.4d401e, 30fps, video only, 67.33MiB
244          webm       854x480    480p  766k , vp9, 30fps, video only, 163.07MiB
135          mp4        854x480    480p  818k , avc1.4d401f, 30fps, video only, 107.59MiB
247          webm       1280x720   720p 1524k , vp9, 30fps, video only, 323.88MiB
136          mp4        1280x720   720p 2313k , avc1.4d401f, 30fps, video only, 319.69MiB
18           mp4        640x360    360p  697k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 163.21MiB
22           mp4        1280x720   720p 1494k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)
$ youtube-dl --get-format -f "worstvideo[height=720]+bestaudio" https://youtube.com/watch?v=8ha4bkni3zg
247 - 1280x720 (720p)+140 - audio only (tiny)

A smallest file size operator would hopefully get 136+140 instead.

@inferiorhumanorgans inferiorhumanorgans mentioned this issue May 24, 2020
2 of 6 tasks complete
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
5 participants
You can’t perform that action at this time.