CogentRedTester/mpv-sub-select

Feature request: Ability to blacklist / whitelist audio tracks

Closed this issue · 8 comments

Consider this example of a file with mislabeled tracks:

 (+) Video --vid=1 'H.264/AVC Video' (h264 720x480 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) 'English: Stereo' (aac 2ch 44100Hz)
     Audio --aid=2 --alang=eng 'Japanese: Stereo' (aac 2ch 48000Hz)
 (+) Subs  --sid=1 --slang=eng (*) 'Titles & Signs' (ass)
     Subs  --sid=2 --slang=eng 'English Subtitles (Anime-Keep)' (ass)

It'd be great if I could say, select the audio track which has "japanese" in its title, before going for eng audio.

Are you suggesting that this script should choose which audio track to use, or choose the subtitle based on the titles of the audio tracks?

If you're talking about the latter then it is definitely possible, and I might be interested in doing it, but I'm a little short on time currently, so I won't be able to do so for the foreseeable future.

If you're talking about the former then that is not a feature I wish to implement because it falls outside the scope of this script. This script is only designed to select subtitles based on the audio, selecting the audio as well would massively complicate things, it'd essentially be implementing two scripts in one, and I prefer to keep these things separate. If it was to be implemented, it would be as a separate script called mpv-audio-select, and while I do have some interest in doing this, as I said before I currently don't have the time. In the meantime you could try using trackselect.

I was talking about the former. Having them as separate scripts wouldn't do, because that means we can't select based on multiple criteria (audio + sub).

Thanks for the trackselect suggestion. I'll give it a try. (But again, if it doesn't support matching by language tag then that wouldn't do either, as track title is not always sensible.)

Can you give an example where both scripts need to be combined into one?

@CogentRedTester It's in the OP. Mislabeled tracks. To be able to handle all these cases, the only solution is to have audio + sub track selection as a combination.

But picking the English audio track with Japanese in the title does not require knowledge of subtitles, it could be handled in an audio-select script. And picking a subtitle track to match this could also be done by implementing an audio whitelist/blacklist in sub-select. The only case I can think of where the scripts would need to be merged is if you only wanted to select the Japanese audio if there were also available English subs with the correct filters. Now this could potentially be useful, but I'm not sure that this ever happens enough for creating a new script to be necessary. Is this case what you were thinking of?, because I don't see how the example in the original post requires 2 scripts.

because I don't see how the example in the original post requires 2 scripts.

You're right. My bad.

But having the ability to match both at the same time does unlock many possibilities, providing the kind of control which is not possible with 2 separate scripts.

The only case I can think of where the scripts would need to be merged is if you only wanted to select the Japanese audio if there were also available English subs with the correct filters. Now this could potentially be useful, but I'm not sure that this ever happens enough for creating a new script to be necessary.

A real-world use case would be anime vs non-anime. It's quite easy to wrongfully select the Japanese (dub) audio track for e.g. a movie that's not originally in Japanese. Of course, matching both at the same time is still not foolproof (i.e. there might be English subs present even in this case), but it'd be an improvement.

You are correct that choosing audio and subtitles in pairs could be very useful. In fact, when I was designing this script I considered implementing a system like that, where pairs of audio/subs were chosen instead of choosing subs based on audio. In the end I decided that would be simpler and easier to use to let the user pick audio and have the sub choice follow since that was enough for 99% of cases, but I can see some might prefer the more fine-grained control.

Unfortunately, this script was very much designed around using the already selected audio, changing it to select audio as well would be quite a significant task, almost a full rewrite. For that reason I would probably want to make a new script anyway, rather than modify this one. While you have made me interested in such a script, I just don't have the time to write it in the foreseeable future, nor can I make any guarantees that I ever will.

I am going to keep this issue open, since the issue of handling mislabeled audio tracks is still around, and I'll probably implement an audio whitelist/blacklist at some point, but once that has been resolved I'll close the issue since I've decided that I won't be adding the audio-selection to this script. However, should I make a new script, I will add another comment to this thread to let you know.

You are of course also free to fork this repository and add the feature yourself, and if you have any more suggestions please let me know.

Pinging this issue to point out that I now have a pull request that implements experimental audio selection behaviour.