-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[RFC] options: add --{sub,audio,video}-file-priority options #15855
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
base: master
Are you sure you want to change the base?
Conversation
A user got bit by this recently and I had to check the implementation details to remember the behavior, so let's change it to be more intuitive. Previously, --subs-with-matching-audio would *only* match against the list of preferred subtitle languages selected with --slang. If that was unset, it did nothing, as vaguely documented, but this is probably unexpected. We keep the --slang matching if applicable, but otherwise check to see if the subtitle track and audio track languages match when going through the --subs-with-matching-audio logic. This prevent users from having to do something like --slang=en --subs-with-matching-audio=no which they probably don't expect.
Old description was misleading in a few ways.
This got refactored so it only loads one file at a time and not everything in a loop. The option resetting at the end of conditional branches is pointless.
Previously only the --slang case existed.
The manual description was not really accurate. It only prevented loading external files in some cases but not always. It also had an undocumented effect on default subtitle selection. Thinking about it though, this option is stupid in the first place. Just set the appropriate --sub-auto, etc. if you don't want external tracks loaded. And also just don't use --external-files and friends in the first place if you don't want external files. The effect on default subtitle selection is desirable but this will be reworked in a new option in the following commits.
51a6089 to
e928b76
Compare
no_default is actually just redundant with no_auto_select and also something that is irrelevant most of the time. no_auto_select was changed in 8ce5e79 to be exactly the same as t->no_default. Furthermore, the select_default_track loop explicitly skips anything marked as t->no_auto_select. So in fact, all of the code checking for t->no_default is totally pointless as it being true could never happen in those places. In command, adding a track as auto also has no relevance to this particular boolean. You just don't switch/mark the track in the first place.
e928b76 to
5912e35
Compare
|
Download the artifacts for this pull request: |
| (e.g. slang or various --subs-fallback options). This defaults to ``yes`` | ||
| meaning that external subtitle files have priority over internal subtitles. | ||
| ``no`` removes any special prioritization whereas ``never`` will prefer | ||
| internal tracks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whereas
neverwill prefer internal tracks.
never should more like "never select". This doesn't sound like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. It's more like deprioritize but that sounds weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just call it inter ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you typo? Not sure what you meant. I was thinking maybe reverse or invert but that also sounds weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--sub-file-priority=<above|normal|below>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works. Let's go with it.
Historically, mpv has always blindly preferred external tracks over internal ones during autoselection. However there are plenty of people out there that load up a ton of tracks at once and don't necessarily want the external one to always be choosen by default. Add some customization by adding a new option for sub, audio, and video files to choose how external tracks should be prioritized if at all. The default for all of these is "true" to match the old historic behavior.
5912e35 to
982026c
Compare
| .deprecation_message = "this option is deprecated and does nothing"}, | ||
|
|
||
| {"sub-file-priority", OPT_CHOICE(sub_file_priority, | ||
| {"below", -1}, {"normal", 0}, {"above", 1})}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it's updated, but not in docs.
| .sub_file_priority = true, | ||
| .audio_file_priority = true, | ||
| .video_file_priority = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .sub_file_priority = true, | |
| .audio_file_priority = true, | |
| .video_file_priority = true, | |
| .sub_file_priority = 1, | |
| .audio_file_priority = 1, | |
| .video_file_priority = 1, |
| deprecate `--autoload-files` | ||
| add `--sub-file-priority` | ||
| add `--audio-file-priority` | ||
| add `--video-file-priority` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally not sure if we need three separate options, it seem like too much fine-grained control. External file is external file. But whatever if you like to have it like that.
Based off of the branch in #15854 since that touches the same general code places and presumably I'll merge it reasonably soon.
Did some minor internal cleanups and added options to allow customization of whether or not external tracks should be preferred. I kind of feel like the default should be
no. In other words, external tracks are treated exactly like internal tracks and there is no preference either way but the PR currently has it set toyesfor compatibility reasons. Not sure how people feel about that.Obviously needs tests. Will do that later.