mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.65k stars 2.83k forks source link

mpv ignoring 'slang' option set on 'mpv.conf' in favor of external subs #14388

Open GuilhermeFrainer opened 1 week ago

GuilhermeFrainer commented 1 week ago

mpv Information

mpv v0.38.0-476-gd2bd77ad Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Jun  9 2024 00:05:17
libplacebo version: v7.349.0 (v7.349.0-rc1-2-gbc9de9c-dirty)
FFmpeg version: N-115628-g658439934
FFmpeg library versions:
   libavutil       59.21.100
   libavcodec      61.7.100
   libavformat     61.3.104
   libswscale      8.2.100
   libavfilter     10.2.102
   libswresample   5.2.100

Other Information

Reproduction Steps

  1. Download video with embedded subtitles (in my case, English).
  2. Download separate substitles (in my case, Japanese) and rename them so their name matches that of the video file.
  3. Put the subs in a separate directory and set a path for that directory on mpv.conf with sub-file-paths
  4. Set slang in mpv so that the external subs' language is last on the priority list (in my case, slang=eng,en,enUS,jpn,jp.
  5. Open video and watch it as mpv ignores the priority list set in slang (choosing the external subs by default).

Expected Behavior

In my case, I was expecting mpv to respect the priority list in slang and choose the (embedded) English subs by default.

Actual Behavior

Mpv instead seemed to ignore the list in slang and set the (external) Japanese subs by default.

Log File

output.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

Dudemanguy commented 1 week ago

That's by design. External subs are always preferred. There are some other scattered issues around related to this (like #6071). Maybe this could be changed or made into an option but no one has ever tried.

hooke007 commented 1 week ago

--alang is facing the same problem. For some devs, external tracks may be preferred. They should think that if you don't want external ones, why leave them here. But for some encoders/users, it's totally different. The more important/necessary tarcks will be embeded in videos. Others will move to the independent files.(Especially for audio tracks)

Dudemanguy commented 1 week ago

It's pretty trivial to just move the language matching check above the external file stuff. But there's probably scenarios where people want the external tracks to be selected first, and I was never sure what the right way to handle that was.

hooke007 commented 1 week ago

Here is the workaround for OP. https://github.com/CogentRedTester/mpv-sub-select

kasper93 commented 1 week ago

It's pretty trivial to just move the language matching check above the external file stuff. But there's probably scenarios where people want the external tracks to be selected first, and I was never sure what the right way to handle that was.

Probably just need an option... like everything.

Dudemanguy commented 1 week ago

Hmm, maybe something like --external-files-priority=<yes|no|auto>. I'm not sure what the best behavior for auto would be. Maybe like: external tracks that are specifically selected but with no language -> language -> external track with language -> autoloaded tracks ?

guidocella commented 1 week ago

I wondered if this option was necessary in https://github.com/mpv-player/mpv/pull/9059. If it is added for every track type it should replace --audio-display's values.

GuilhermeFrainer commented 1 week ago

Here is the workaround for OP. https://github.com/CogentRedTester/mpv-sub-select

I couldn't get it to work either unfortunately. Got the exact same issue. This is the sub-select.json file I was using:

[
    {
        "alang": ["jp", "jpn"],
        "slang": ["eng", "en", "enUS"],
        "condition": "not sub.external"
    }
]

I tried changing a few things around to no avail.

hooke007 commented 1 week ago

I couldn't get it to work either unfortunately.

You should report to the script creator, not here.

kasper93 commented 1 week ago

Maybe like: external tracks that are specifically selected but with no language -> language -> external track with language -> autoloaded tracks ?

Not sure I understand what you mean exactly. I think the external track with language specification should be preferred over internal tracks, if both matches slang selection.

Dudemanguy commented 1 week ago

I was only suggesting putting external tracks with languages on the same "level" as the general language matching. But the external tracks would still be chosen before internal ones assuming there's no language-based selection. If we want to add the additional variable of preferring external vs internal tracks, we can but yeah it gets even more complicated.