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
[Discussion] Upcoming changes to format selection #4846
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
It will be handled the same way pre-merged formats are; i.e. better video is prefered |
More changes:Custom tokenizerThe current format selector code abuses Standardization of filtering operatorsWhile |
I understand that |
I don't think so, but I like your proposal anyway |
Another potential change that has been proposed multiple times is #5629 Prioritize AV1One of the other weird quirks of yt-dlp's default format selection is the de-prioritization of Line 1540 in f14c233
Since playing DV is pretty niche and playing it on anything that's not compatible will significantly degrade quality, I think it makes sense to leave it de-prioritized permanently. On the other hand, the AV1 exception was always intended to be removed eventually. It still don't have out of the box support on many systems1, but most sensible players does already support it. Hardware support is still lacking, but that is not a So, perhaps it's time for us to make the change? Footnotes
|
@pukkandan I think Prioritizing AV1 below 4k is definitely needed. 1440p and below is starting to become rather common and can be decoded on CPU fine for many people, it's 4k that really needs hardware decode which most people don't have. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I'm confused. Is yt-dlp going to use @Kenshin9977's proposal? If yes, the initial post should be updated imo |
Currently undecided. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
@kasper93 There is a separate issue open for it already (and I'm working on it rn). This is not place to discuss site specific format issues. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@pukkandan With regard to "Standardization of filtering operators," is there a plan to add support for logical OR of conditions in format filtering? Logical OR for match-filter was added in #3144, but currently there is no mechanism to pick the best video out of those that match either condition A or B. It was implemented for |
|
I thought This is not the same as Concrete examples:
|
note that on youtube vp9.2 has been found to be better then hdr av1 |
That was 3 years ago though. Maybe AV1 HDR encoding quality has improved since then. P.S. but imho SDR should be preferred over HDR by default. |
Changelog available [here](https://github.com/yt-dlp/yt-dlp/releases/tag/2022.10.04) **Note:** There are some small changes coming to format selection syntax and defaults in a release or two. See [here](yt-dlp/yt-dlp#4846) for details. Signed-off-by: Thomas Staudinger <Staudi.Kaos@gmail.com>
The most recent MacOS release (Sonoma) adds AV1 support and the new M3 processors have hardware decoders for the codec. This would likely remove the Apple blockers mentioned in #4846 (comment) going forward. |
The particular use case I have is that I'd like to download youtube videos with the best audio formats in all of the available languages out of i.e. I want to build a format string that expresses:
Right now, as far as I've been able to figure out, the only way to do this is to generate all the possible combinations of languages in a chain of fallbacks, so this is what I have listed in my yt-dlp config: It's a good thing I only have 3, because this is a combinatorial explosion situation :/ Alternatively, or perhaps additionally, a user-friendly |
@kepstin Your use-case will be handled by the "of each" operator. However, this project is currently on hold due to a lack of time. |
If you are here only to check for changes to the defaults, just read "Multistreams" and "Default selector for stdout" sections
Superseeds #389
"maybe merge" operator
A new operator
+?
will be added. It is similar to+
, but will always work as-if multistreams were disabled; i.e. The RHS will be added to the format only if the LHS doesn't already have the same kind (audio/video) of stream. This deprecates the need for--(audio/video)-multistreams
"of each" operator
A new operator
<field>
will be added that is used to select the best format for each value offield
; e.g.bv<height>, ba<language>
will select the best video format of each height and best audio of each language."type" field
Supplementing to the "of each" operator, a new field
type
will be added to the format dict that can be used by the extractor to separate the different types of formatsFilterable groups
Currently, filters
[...]
applied on groups(...)
are simply distributed over it's components. So it is not possible to, say, download the "best format under 1G". You may expect(bv*+ba)[filesize<1G]
to work - but it translates tobv*[filesize<1G]+ba[filesize<1G]
which is not what we want.While I can simply fix this behavior, that would break compatibility and I am afraid some users may actually be making use of the above "feature". So instead, a new type of grouping
{}
will be added. Then{bv*+ba}[filesize<1G]
will work as expected, while()
will retain it's old behavior.Multistreams
youtube-dlc had added the ability for us to merge multiple audio (and video) formats into one file. So far, yt-dlp has kept this option behind the multistreams switches so that the default selector of
bv*+ba
can work correctly. However, the way this works is confusing and so these options will be enabled by default. The default selector can now handle this using+?
- see below.Default selector
The default selector will be changed to
bv*+?ba/b
. This means that the best video format will be selected, and if it doesn't have an audio stream, the best audio format will be merged with it. This is effectively the same as the current default, but works irrespective of whether multistreams are enabled or not.Default selector for stdout
Currently, if you use
-o -
, the default selector isb/bv+ba
. However, yt-dlp has had the ability to stream multiple formats to stdout (using ffmpeg) for a while. So this default will also now be changed tobv*+?ba/b
. Note that this will cause the download to happen through ffmpeg. If you don't want this, you will need to give-fb
.PS: This change may be postponed due to #4478
Documentation
A lot of the format selection documentation is a mess and it would be good to take this opportunity to rewrite it. But I suspect any documentation I write will end up even less user-friendly that the current one. So any help with this would be appreciated (make a PR). If no one wants to do this, I will abandon the idea and just add the new changes to the current documentation.
I have an inital implementation of most these, but they need a lot of cleanup. I will open a PR when ready. In the mean time, I would appreciate any feedback on the above changes, and am also open to suggestions for better syntax for the new operators. I am not too happy with the current ones, but couldn't think of anything better.
Related #4553
The text was updated successfully, but these errors were encountered: