As for automatic detection, now I know that paths start with "/" sign in Linux:Automatic detection doesn't work (1.avi and 1.srt at the same location, the path contain only English characters, Linux 32), but with fixed path the extension works excellent!
This is already implemented in a new VLC Extension: Show Me the Meaning, but apparently it also does not work for you.It works with
media_uri = "/"..string.gsub(media_uri, "^.-///(.*)%..-$","%1")
or
media_uri = "/"..string.gsub(media_uri, "^.*//(.*)%..-$","%1")
in Linux
Code: Select all
-- find line starting with "vlc.var.add_callback" and add following new line there:
vlc.var.add_callback( vlc.object.libvlc(), "key-pressed", key_press )
-- find line with "vlc.var.del_callback" and add following new line there:
vlc.var.del_callback( vlc.object.libvlc(), "key-pressed", key_press )
-- edit "if actual_time>=v[1] and actual_time<=v[2] then" line to this:
if actual_time>=v[1]+delay and actual_time<=v[2]+delay then
-- edit "if actual_time<subtitle[1] or actual_time>subtitle[2] then" line to this:
if actual_time<subtitle[1]+delay or actual_time>subtitle[2]+delay then
-- add following new lines at the end of the script:
delay=0
function key_press( var, old, new, data )
local actual_time = vlc.var.get(vlc.object.input(), "time")
if new==33554536 then at=actual_time end -- Shift+h -- audio timestamp
if new==33554538 then st=actual_time end -- Shift+j -- subtitle timestamp
if new==33554539 then delay=at-st end -- Shift+k -- +/-delay
end
Code: Select all
if new==2228224 then -- right arrow -- jump to next subtitle
local input = vlc.object.input()
local actual_time = vlc.var.get(input, "time")
for i,v in pairs(subtitles) do
if actual_time<v[1]+delay then
vlc.var.set(input, "time", v[1]+delay)
break
end
end
end
if new==2162688 then -- left arrow -- jump to previous subtitle
end
Ah, do you mean that VLC 2 can actually play multiple subtitles if they are encoded the same way and are not independent, i.e. put in the same file (e.g. both are in the same .sub or both in the same .mkv file)? I spent my one hour time to do this homework and didn't find a way to do so with Google.I have just tried VLC 2. You probably mean improved detailed settings for subtitles and output rendering. That is much better now. But it still cannot play multiple independent (each uses own proper encoding) subtitles at the same time.
Code: Select all
!s:: ;set hotkey to ctrl+s
Code: Select all
#Persistent
#s:: ;set hotkey to Win+s
IfWinExist, Subtitler (lite) mod
{
MsgBox,64,Autohotkey Script started,Autohotkey Script started.Subtitler lite button will be pressed 10 times per second,5
While WinExist(Subtitler (lite) mod)
{
WinActivate Subtitler (lite) mod
Send {Enter}
Sleep, 100
}
MsgBox,0,Autohotkey Script ending,Autohotkey script ending. Press Win+s to restart,4
}
else
{
MsgBox,0, Error, Couldn't find window with title "Subtitler (lite) mod". Press Win+s to try again.
}
Return
Code: Select all
#IfWinExist, Subtitler (lite) mod
#s:: ;set hotkey to Win+s
MsgBox,64,Autohotkey Script started,Autohotkey Script started.Subtitler lite button will be pressed 10 times per second,5
While WinExist(Subtitler (lite) mod)
{
WinActivate Subtitler (lite) mod
Send {Enter}
Sleep, 100
}
MsgBox,0,Autohotkey Script ending,Autohotkey script ending. Press Win+s to restart,4
Return
#IfWinExist
Return to “Scripting VLC in lua”
Users browsing this forum: No registered users and 3 guests