-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add a "--secondary-slang" option #4209
Comments
As no one has answered your question yet I'm going to take the shot and tell you that your issue is |
Thanks for your time. The URL I provided has youtube auto-generated subtitles. I would like to see two subtitle tracks on the video at the same time : one in French and the other in English. But the problem is that the SIDs are for each language are not always the same (maybe because these subtitles are auto-generated by Youtube) :
|
I see. There's currently no way of doing so. Let's see what the higher ups will do about it. |
You can do this with a script |
I should add that if possible, the secondary sub should not be loaded if it's the same as the primary. One major use case for this is language learning/practice. I'd like to specify |
I created this script until this feature is implemented. You can change the secondarySubtitleLanguages = {"dut", "eng"}
function setSecondarySubtitle()
local languagePriorities = {}
for index,language in ipairs(secondarySubtitleLanguages) do
languagePriorities[language]=index
end
local secondaryTrackNumber
for trackNumber = 0, mp.get_property_number("track-list/count") do
if getTrackListProperty("type", trackNumber) == "sub" then
local trackLang = getTrackListProperty("lang", trackNumber)
if languagePriorities[trackLang] and
(not secondaryTrackNumber or languagePriorities[trackLang] < languagePriorities[getTrackListProperty("lang", secondaryTrackNumber)]) then
secondaryTrackNumber = trackNumber
end
end
end
if secondaryTrackNumber then
mp.set_property_number("secondary-sid", getTrackListProperty("id", secondaryTrackNumber))
else
print("No suitable secondary subtitle found.")
end
end
function getTrackListProperty(subProperty, trackNumber)
return mp.get_property("track-list/" .. trackNumber .. "/" .. subProperty)
end
mp.register_event("file-loaded", setSecondarySubtitle) @lalomartins if you choose the same secondary sub as the primary it is already ignored by mpv. |
Hi,
I'm using mpv v0.24 on Ubuntu Linux and I would like two display a secondary subtitle knowing that the subtitles SIDs provided by youtube are not always in the same order.
Therefore the
--secondary-sid
option does not help because I do NOT know the SID number before actually playing the video with mpv :Here is the example URL : https://www.youtube.com/watch?v=QS2mzHP1Cx4
Can you please consider my idea ?
The text was updated successfully, but these errors were encountered: