-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
How to choose Traditional Chinese subtitle automatically? #6885
Comments
https://www.loc.gov/standards/iso639-2/php/code_list.php The ISO 639-2 character code for Traditional Chinese is zho. |
Sounds like Chinese pirates should conform to ISO standards then instead of abusing track titles for something they're not for. |
It doesn't look like "Chinese" pirates at all. |
It looks like I misinterpreted that table earlier, sorry. From a little more digging, there is no ISO 639-2 (or even 639-3, maybe?) code to differentiate between the writing forms of Chinese. What chi and zho actually are, are simply codes designating the ISO's internal English-based organizational system for the language codes (chi), and one that's based on the native name for the language (zho, at least I guess for some dialects). This is actually a known issue with the language selection in the Matroska format itself: So yeah, putting 'Traditional' or 'Simplified' in the track titles looks like a necessary kludge until the Matroska specifications update to allow setting that distinction. EDIT: The FAQ from the first link: The suggestion there is that the script code gets appended to the 639-2 language code. Not sure if that style was ever floated for use in Matroska, although according to https://gitlab.com/mbunkus/mkvtoolnix/issues/2419, one likely option is that in MKVToolNix there might eventually be support for the recently-added |
Probably you can write a script to detect the track title (through this property: https://mpv.io/manual/master/#command-interface-track-list/n/title) to auto-select the TC track. Otherwise if multiple Or just write a folder-specific/file-specific |
@zc62 I don't understand, what does the N suppose to mean in
|
No. You should first query the total number of tracks:
See https://mpv.io/manual/master/#command-interface-track-list In the loop of EDIT: of course you would want to make sure you first filter by |
I just wrote one. @laichiaheng mp.register_event("file-loaded", function()
local count = mp.get_property_native("track-list/count")
for N = 0,count-1,1 do
local type = mp.get_property_native("track-list/" .. tostring(N) .. "/type")
if type == "sub" then
local lang = mp.get_property_native("track-list/" .. tostring(N) .. "/lang")
if lang == "chi" then
local title = mp.get_property_native("track-list/" .. tostring(N) .. "/title")
if title == "Traditional" then
local id = mp.get_property_native("track-list/" .. tostring(N) .. "/id")
mp.commandv("set", "sid", id)
return
end
end
end
end
end) Change the line if title == "Traditional" then to if title == "Traditional" or title == "繁体中文" then or even if string.find(title, "Traditional") or string.find(title, "繁") then if you want. |
Perhaps it would be worth it to have a |
@zc62 How do you get these syntax: |
By the way, it should be "繁體中文" |
What |
@CounterPillow I actually had a similar feature request, see #5133.
|
@laichiaheng Just try if my script works or not. If you want to learn scripting for mpv, learn lua first. |
@zc62 Yes, it works. |
see #5133. |
There's https://github.com/CogentRedTester/mpv-sub-select which is already listed on https://github.com/mpv-player/mpv/wiki/User-Scripts Seems like the best solution without having to write your own script. |
mpv version and platform
mpv 0.29.0-372-g80552ab28e Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 56.33.100
libavcodec 58.55.100
libavformat 58.31.101
libswscale 5.6.100
libavfilter 7.58.100
libswresample 3.6.100
ffmpeg version: N-94597-g74e6800381
Reproduction steps
slang=chi
Expected behavior
Choose Tradtional Chinese
Actual behavior
Choose Simplified Chinese
The text was updated successfully, but these errors were encountered: