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

Need option to prioritize different conditions #10506

Open
Saklad5 opened this issue Aug 31, 2016 · 5 comments
Open

Need option to prioritize different conditions #10506

Saklad5 opened this issue Aug 31, 2016 · 5 comments

Comments

@Saklad5
Copy link

@Saklad5 Saklad5 commented Aug 31, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.08.31. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.08.31

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

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

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

$ youtube-dl -v <your command line>
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] youtube-dl version 2016.08.31
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {}
...
<end of log>

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):


Description of your issue, suggested solution and other information

I would like to be able to automatically get the best possible file, regardless of format, but still prefer a format if the highest quality is available in it. At the moment, this isn’t really possible.

On YouTube, for instance, MP4s are not available in 8K. WebM is, so the behavior I’d like is to download that. However, this will only occur if I do not specify a preferred format at all, using “bestvideo". If I add that argument to my config file, I won’t download MP4 even when it is available at the highest quality. Even if I immediately convert it to MP4 using ffmpeg, this wastes power and time needlessly.

The alternate approach, of course, is to use “bestvideo[ext=mp4]”. This will download the best available MP4 file, which is ultimately what I want in most cases. However, using such an argument with the aforementioned 8K video will result in a 4K MP4, as YouTube does not provide higher resolutions in that format.

Right now, there is a way to prioritize a chosen format and choose the best from it. I believe there should be the opposite as well: prioritize the best quality, and choose a format from that if available. That means it would always download the best, preferring a given format but choosing another one if it isn’t available.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 31, 2016

Provide concrete example.

@Saklad5
Copy link
Author

@Saklad5 Saklad5 commented Aug 31, 2016

“youtube-dl https://www.youtube.com/watch?v=sLprVF6d7Ug https://www.youtube.com/watch?v=sLprVF6d7Ug -f bestvideo” gives an 8K WebM video.
“youtube-dl https://www.youtube.com/watch?v=sLprVF6d7Ug https://www.youtube.com/watch?v=sLprVF6d7Ug -f bestvideo[ext=mp4]” gives a 4K MP4 video.

“youtube-dl https://www.youtube.com/watch?v=IJhgZBn-LHg https://www.youtube.com/watch?v=IJhgZBn-LHg -f bestvideo” gives a 4K WebM video.
“youtube-dl https://www.youtube.com/watch?v=IJhgZBn-LHg https://www.youtube.com/watch?v=IJhgZBn-LHg -f bestvideo[ext=mp4]” gives a 4K MP4 video.

I want to have youtube-dl get me the 8K WebM video from the first link and the 4K MP4 video from the second link.

@Starsam80
Copy link
Contributor

@Starsam80 Starsam80 commented Aug 31, 2016

What about -f "bestvideo[ext=webm][height>2160]/bestvideo[ext=mp4][height<=2160]"? It seems to work for me:

$ youtube-dl -f "bestvideo[ext=webm][height>2160]/bestvideo[ext=mp4][height<=2160]" "https://www.youtube.com/watch?v=sLprVF6d7Ug" "https://www.youtube.com/watch?v=IJhgZBn-LHg"
[youtube] sLprVF6d7Ug: Downloading webpage
[youtube] sLprVF6d7Ug: Downloading video info webpage
[youtube] sLprVF6d7Ug: Extracting video information
[youtube] sLprVF6d7Ug: Downloading MPD manifest
[download] Destination: Ghost Towns in 8K-sLprVF6d7Ug.webm
[download] 100% of 397.69MiB in 00:31
[youtube] IJhgZBn-LHg: Downloading webpage
[youtube] IJhgZBn-LHg: Downloading video info webpage
[youtube] IJhgZBn-LHg: Extracting video information
[youtube] IJhgZBn-LHg: Downloading MPD manifest
[download] Destination: How Earth Moves-IJhgZBn-LHg.mp4
[download] 100% of 1.17GiB in 01:38
@Saklad5
Copy link
Author

@Saklad5 Saklad5 commented Aug 31, 2016

That’s my current solution. That may not work with other sites, however, and it is a rather makeshift solution anyway.

@Saklad5
Copy link
Author

@Saklad5 Saklad5 commented Sep 19, 2016

If this isn't clear, my issue is that the solution mentioned above works on the assumption that MP4s are available up to 4K, and not available above that. This may only be true for YouTube, and may not apply to other extractors or even YouTube itself in the future.

I feel it is preferable to actually specify what I desire in the config, rather than specifying a series of requirements that just HAPPEN to do what I want right now. This is a broadly applicable improvement, too, and unless I am mistaken is easy to implement. I'd do it myself if I had the time to work out how GitHub commits work right now.

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