[Extension] subtitler >> External / Dual subtitles

Discuss your Lua playlist, album art and interface scripts.
flipside5
New Cone
New Cone
Posts: 8
Joined: 19 Feb 2013 22:52

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby flipside5 » 15 Jul 2014 04:42

Hello again mederi,

I've just returned to using your extension after a long break. This time, I don't seem to be able to get it working correctly. The only way I can get it to display any kind of subtitle is like this:

1. Click the "subtitler (lite) mod" option at the bottom of the View menu. That causes a refresh button to display on the screen.
2. When somebody is speaking click on the refresh.

That method gets the subtitle for the current line of dialogue to display on the screen. But after that it doesn't display anything else.

If you could advise me how to sort this out, so that it displays all of the subtitles, I'd be very grateful.

I'm using VLC 2.1.3

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby mederi » 15 Jul 2014 12:15

Press and hold "Enter" key or keep clicking on the [Refresh] button in the dialog window :-) Use some "keypresser" or "keysender", an external application that is able to send "Enter" keystrokes to "Subtitler (lite) mod" window in certain time interval (about 100 ms) automatically. I have written and enclosed a simple VBScript for Windows users. Linux users could find some application on the Internet and share their recommendation right here.

flipside5
New Cone
New Cone
Posts: 8
Joined: 19 Feb 2013 22:52

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby flipside5 » 15 Jul 2014 12:29

OK. Thanks. I'll see about setting something up with autohotkey. Has something happened in a recent release of VLC to make this necessary? I don't recall it working like that before.

flipside5
New Cone
New Cone
Posts: 8
Joined: 19 Feb 2013 22:52

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby flipside5 » 15 Jul 2014 14:47

Here's my autohotkey script, in case anyone is interested.
To use it:

1. Installl autohotkey
2. Copy the code below into notepad, or something similar.
3. Save it somewhere with an extension of ahk. E.g. subtitlerlite.ahk
4. Double click on the saved file.
5. Start merdi's extension (in the View menu, click "subtitler (lite) mod")
5. Press Win+s. (i.e. press Windows Key/Start button at the same time you press the "s" key). This will start automatically clicking the refresh button for merderi's script.
6. If you want to use ctrl-s instead of Win-s, change the second line to be this:

Code: Select all

!s:: ;set hotkey to ctrl+s
That is, replace # with !
You can set the hotkey to be anything you like, as described here.

Thanks to mederi for all of his hard work on this.

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

roland1
Blank Cone
Blank Cone
Posts: 44
Joined: 01 May 2014 16:49

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby roland1 » 15 Jul 2014 20:48

To circumvent global binding I suggest the use of #directives, maybe so :)

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

flipside5
New Cone
New Cone
Posts: 8
Joined: 19 Feb 2013 22:52

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby flipside5 » 15 Jul 2014 20:56

Sounds good to me. I don't quite understand how it all works, but I'm sure you know more about ahk than I do!

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby mederi » 25 Jul 2014 16:42

Is it possible to send a keystroke to an inactive window (without activating the "Subtitler (lite) mod" window)?
Is it possible to remember current active application (window), then temporarily activate a dialog box of some VLC Lua Extension and then reactivate the previous application using the AutoHotkey?

roland1
Blank Cone
Blank Cone
Posts: 44
Joined: 01 May 2014 16:49

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby roland1 » 25 Jul 2014 17:42

Probably Yes to all. Related commands/functions are controlsend, winexist(), winactivate.
Also see:
http://www.autohotkey.com/docs/commands.htm
To get the necessary window/control identifiers (ClassNN etc) run window spy (which (at least) was part of the ahk installation). Controlsend can be a show stopper, so, starting with it is advised.

danielgr
New Cone
New Cone
Posts: 2
Joined: 30 Nov 2014 03:06

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby danielgr » 30 Nov 2014 03:14

Hi there,
First of all, thanks so much for developping this add-on.
I've been struggling for years with this problem, and I'm incredibly glad to finally have found a relatively simple way, if not very elegant, but so much better than nothing !

So I just wanted to add my two cents.
I tried the AutoHotKey script in my W10 Preview machine and it was not working, so instead I tried a couple of utilities I found on the net:
* Auto Key Presser
* Key Presser .

The first one works, but it's annoying because one cannot set up an initial delay to start pressing the (enter) key, so subtitles are always a bit late.

The second one is my current choice, because it allows you to select the window you want to press the key, as well as an initial delay and interval.

So anyway, just thought I would share.

Thanks again for developing the add-on !!!

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby mederi » 02 Dec 2014 13:59

Doesn't the included "keypresser.vbs" work for you? I think that VBS scripts should work in all Windows. You just play a film, pause it if you want, activate the "Subtitler (lite) mod" extension, start the "keypresser.vbs", unpause the film by clicking Play/Pause control button, double-click the playing video for full screen mode, enjoy. And you would still be able to control playback (pause/play, rewind, ...) with mouse. You could have the initial delay, too. Just edit the script and prepend following new line for 10 seconds delay:

Code: Select all

WScript.Sleep 10000
The suggested Key Presser 1.3 is good one, but it does not work for me if "Subtitler (lite) mod" window does not have focus.

iamtodor
New Cone
New Cone
Posts: 8
Joined: 07 Mar 2018 09:00

Re: [Extension] subtitler >> External / Dual subtitles

Postby iamtodor » 29 Jan 2019 11:20

Any plans to implement this feature? I would donate you for 10$ for an opportunity to turn on 2 different subtitles :)

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: [Extension] subtitler >> External / Dual subtitles

Postby mederi » 29 Jan 2019 15:46

You can already use this extension to show subtitles from an external srt subtitle file. The usage is a bit cumbersome (an external button presser required), but at least it works. You can also show subtitles in a dialog box window (useful with audio files or current text-to-speech integration). Then you can turn standard VLC subtitles to a different source.

kielerrr
New Cone
New Cone
Posts: 1
Joined: 24 Aug 2019 23:57

Re: VLC Extension: subtitler >> External / Dual subtitles

Postby kielerrr » 25 Aug 2019 00:05

Is it possible to send a keystroke to an inactive window (without activating the "Subtitler (lite) mod" window)?
Is it possible to remember current active application (window), then temporarily activate a dialog box of some VLC Lua Extension and then reactivate the previous application using the AutoHotkey?
I had trouble with the original AHK script as well, as it requires the window to be focused. The AHK code below will send the Enter command even if the Subtitler window is minimized. It doesn't interfere with any other windows unless that window also contains 'Subtitler (lite) mod' in the window title. Tested in AHK 2.0 but I'm pretty sure it can easily be run in 1.0 as well.
This runs automatically, so make sure the subtitler window is active. Press escape to terminate.

Code: Select all

#SingleInstance TargetWindw := "Subtitler (lite) mod" #If WinExist (TargetWindw) MsgBox "Starting Subtitler" while WinExist(TargetWindw) { Sleep 100 ControlSend "{Enter}",,TargetWindw } return Esc:: MsgBox "Ending Subtitler" ExitApp return
Edit: Added esc key

jmon12
New Cone
New Cone
Posts: 6
Joined: 11 Oct 2020 23:09

Re: [Extension] subtitler >> External / Dual subtitles

Postby jmon12 » 13 Oct 2020 18:31

First of all thank you for your very useful extension! VLC 4 is supposed to have this feature, but I compiled it from source and didn't find a way to make it work. See this post /https://forum.videolan.org/viewtopic.php?t=154662 and the corresponding feature request https://trac.videolan.org/vlc/ticket/824#no1.

Your extension works like a charm for me under Arch linux, kernel 5.8.14-arch1-1 (with KDE desktop environment), and vlc 3.0.11.1.

However, I have a problem with the use of xdotool and your extension to automatically refresh, without focusing on the Subtitler dialog window. The following (very simple) bash code works as expected, except when the focus is on the main VLC window, which obviously what I want.

Code: Select all

TITLE="Subtitler \(lite\) mode" while true do xdotool search --name "${TITLE}" key "Return" sleep 0.1 done
I'm neither an expert of xdotool or VLC, but I think that's not related to xdotool, and a superficial research didn't prove me wrong yet. Any clue where that could come from in your implementation?

I would be very happy to contribute, at least for testing a few scenarios if you give me some clues, but I might not be the most competent to solve the problem on my own.

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: [Extension] subtitler >> External / Dual subtitles

Postby mederi » 14 Oct 2020 14:11

I believe the feature is already implemented in VLC 4. Are you sure that you cannot select the secondary subtile track in VLC menu if you load several subtitles for a playing video? Last year VLC 4 NB did not work for me on a weak Windows 7 netbook (some OpenGL error). I will try it again.
As for the extension, the question is whether it is possible to send "Enter" key strokes to a dialog box without focusing that window. In previous post user kielerrr says AHK script can do it on Windows.

jmon12
New Cone
New Cone
Posts: 6
Joined: 11 Oct 2020 23:09

Re: [Extension] subtitler >> External / Dual subtitles

Postby jmon12 » 14 Oct 2020 14:46

Thank you for your quick answer.
I didn't extensively visit the UI of VLC 4, but didn't find a way to add the second subtitles track. And didn't find anyone who succeeded on the internet neither. I'll search further. If you succeed in making it work on Windows, please let me know.

Yes it is possible to send the keystroke without the Window being active. My very simple script works with any window focused, except the main VLC one. This is why I think that it is somehow related to the extension, but that's just a guess.

jmon12
New Cone
New Cone
Posts: 6
Joined: 11 Oct 2020 23:09

Re: [Extension] subtitler >> External / Dual subtitles

Postby jmon12 » 16 Oct 2020 12:20

OK I finally understood how to make it work with VLC4, see this post https://askubuntu.com/questions/216734/ ... ltaneously.

I updated the corresponding thread: https://forum.videolan.org/viewtopic.ph ... 04#p509704.

Your extension finally becomes legacy, thank you for the great work!

Kaka123
New Cone
New Cone
Posts: 1
Joined: 22 Jan 2022 00:18

Re: [Extension] subtitler >> External / Dual subtitles

Postby Kaka123 » 22 Jan 2022 00:22

Hello, I don't find the option "Tools>Preferences>Subtitles/OSD>Dual Subtitles" on any version of vlc 4.0 win64 :/.
Thanks you for any response :)


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 7 guests