Last active
February 20, 2023 06:07
-
-
Save bugdone/3ad65d79e70fc8ad590111f9897e4e89 to your computer and use it in GitHub Desktop.
Display ko and en subtitles simultaneously in mpv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dualsubs() | |
local i = 0 | |
local tracks_count = mp.get_property_number("track-list/count") | |
while i < tracks_count do | |
local track_type = mp.get_property(string.format("track-list/%d/type", i)) | |
local track_lang = mp.get_property(string.format("track-list/%d/lang", i)) | |
local track_id = mp.get_property(string.format("track-list/%d/id", i)) | |
if track_type == "sub" then | |
if string.match(track_lang, "en") then | |
mp.set_property_number("sid", track_id) | |
end | |
if string.match(track_lang, "ko") then | |
mp.set_property_number("secondary-sid", track_id) | |
end | |
end | |
i = i + 1 | |
end | |
end | |
mp.register_event("file-loaded", dualsubs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment