Jul 19, 2011

Automatically download subtitles in VLC player

You can write VideoLAN VLC player's extensions in LUA programming language.
Extensions are in Videolan\VLC directory lua\extensions directory.

This is a modified extension to automatically download subtitles.

Download extension
Save extension (the code/text file) as AutoSubtitles.lua in the extensions directory mentioned above.

Will add more languages upon request.
Currently this extension is intended for personal use.



Henrique Silva said...

u're my hero
kudos =]

Cipricus said...

can i save the subtitle for later or off-line use?

jean caffou said...

No, sorry, this is currently not implemented. Good idea though, I'll think about it.

jean caffou said...

On a related note, there is a lot of software that does just that - downloads subtitles for later, offline use.

I was going in another direction.

Cipricus said...

There are players that do it (mpc, Bsplayer free, there are others that i did not tested) but VLC is so much better that it would be excellent for it to do that too, especially that this extension of yours seems to produce more results than other players that download subs to the hard disk. Is it only opensubtitles that is accessible in this way? Subscene seems even better these days

jean caffou said...

I am querying the opensubtitles database as well as the slovenian site podnapisi.net (http://www.sub-titles.net/) - which has a crapload of subtitles in many languages.

These two sites combined give best results.

Also, some idiots making releases can't decide how to enumerate series and episodes, some are using S11E11, some 11x11, and some people just write it like 1111, which is rather unfortunate because many movies have release date, like blahblah 2002 and this get's parsed as the season and episode number.

If you're not getting any results, remove all of the other stuff and just leave the movie title.


Pixel said...

Hello jean and thx for the plugin ;).
Could you add french language ? I tried to add it directly in the code without any success.

languages = {
{ title = "English", tag = "en" },
{ title = "French", tag = "fr" }

Thx a lot ;) !

paulo said...

work in linux?

virajk said...

Thanks a lot, really appreciate your effort !

jean caffou said...

Hey guys, thanks for the comments.

Pixel, as for the extra languages, I think using the original plugin should be enough, as it only sends a query to OpenSubtitles, and it already has an option for French language. Link to original plugin: http://goo.gl/mx2j9

paulo, Plugin is OS independent. If your VLC runs in Linux, the plugin should too. Just locate the lua extensions folder.

jean caffou said...

I have added support for more languages. English (default), Slovenian and French are now included in the code, however you can add your own language like Pixel already pointed out.

Download new code from GitHub: http://goo.gl/610Eq

Anonymous said...

how to do it ? ?
can you explain it a bit. ? ?

jean caffou said...

Save the text from here:

into a file called
C:\Program Files (x86)\VideoLAN\VLC\lua\extensions\AutoSubtitles.lua

then run VLC and click View -> AutoSubtitles, when you're watching a movie.

Anonymous said...

Could not find the extensions part in lua ... >?

jean caffou said...

If the directory does not exist, you need to create it. In the newer versions of VLC the directory extensions is not there.

Anonymous said...

i dont have the Extensions part in there...
i tried by even uninstalling the older and installing new again . . ??

jean caffou said...

Go to:
C:\Program Files (x86)\VideoLAN\VLC\lua\

right click -> new folder
name it: extensions. Put the .lua file in there

It's simple, really.

Anonymous said...

may be you can help me..
i dont know how to do this all ..
Sorry . . =[[

Anonymous said...

i made the new folder : extensions
but then how can i put this link in there. . ?

Anonymous said...

i know im bothering you..
but please help me...... </3

jean caffou said...

1. Go in the folder extensions
2. Right click -> new -> text file
3. Name it "AutoSubtitles.lua" and open it in notepad
4. Make sure the extension of the text file is .lua and not .txt. You might need to enable "show extensions of known files" in Windows. (how-to: http://support.microsoft.com/kb/865219)
5. Open this link https://raw.github.com/jeancaffou/VLC-Player-Auto-Subtitles/master/AutoSubtitles.lua
6. Copy all the code from the link to that text file and save it.

There might be some problems in windows 7 or vista, because you would need administrator privileges.
To fix this, create the .lua file in the desktop, copy the code, save it, and then copy the file from the desktop to extensions folder.

Anonymous said...

wow... it worked..omg..
thanxx soo much. . :)

jean caffou said...


M said...

Im having problems with scandinavian letters (ä,ö,å)
Dont know if this is issue with the code itself or just with subtitles. Could look into it?

jean caffou said...

Err.. Try now.

M said...

It is a subtitle error, because I tried other films and those were just fine.
Something related to ISO coding I think.

jean caffou said...

Ah, OK. Then this is not a problem with the extension, but the subtitle file itself - it is not properly encoded.
The extension has no control over it. You're gonna have to download the file by hand, and use a tool like Notepad++ to change encoding. Or download an other subtitle.

M said...

Will do. Thanks for the plugin tho.

Aurangzaib SS said...

I did everything as stated above but vlc is not showing any autosubtitles options.

Anonymous said...

is it working on Mac OS too?
I opened the VLC packet content, created the folder extensions in the lua folder and created the file.
but no subs.

jean caffou said...

As far as I know, it should. Check and see if the file contains only the LUA code and it has no HTML traces or something like that, because it will break the code.

Anonymous said...

Thank you very much!
I use Mac and it works perfectly. I created a file inside the ULA file (contents->MacOS->share->ULA) called extensions and I copied your file. The options on VLC to active the autosubtitles are in side the VLC menu below preferences :) I hope it helps Mac users!

Anonymous said...

working great .. if you follow the instructions, you won't have any problem
Thanks for your work

stt said...

user directory for lua extensions on mac is ~/Library/Application Support/org.videolan.vlc/lua/extensions

Anonymous said...

Created the lua file and copied to the new extensions folder. I am unable to find the autosubtitles options. Could u help me? Thanks a million!

vladx said...

Hi Jean,

Could you also add the Subtitlesseker search engine as an option instead of OpenSubtitles? If you don't have time it's ok, I can do it myself but it would take longer for me since I'd need to learn Lua's specific functions and get used to it. I just think IMHO that Subtutleseeker is the best subtitle search engine.


fungunfanatic said...

whenever I play more than 1 episode at a time in vlc it crashes vlc when it switches to the next episode. also if your just watching 1 thing and you let it run till the time is out it also crashes, when I say crashes I just mean it says "Not Responding". Any fix for this or are you aware of this?

Anonymous said...

Autosubtitles is broken in the latest VLC 2.1 on Windows. VLC reports an error trying to load the subtitles file, which appears to be a large concatenation of the local file path, the HTTP download URL, and the ZIP archive itself. It sure doesn't look like a valid filename, but maybe that's the way VLC handles it internally. I had to downgrade VLC back to 2.0.8 and it works again. VLSub is also broken in 2.1, but apparently for different reasons (removal of the net library). Please fix if you can, as I depend on Autosubtitles and would like to take advantage of the 2.1 improvements!

jeancaffou said...

A workaround has been added (not really a fix).
It won't crash anymore, but it also won't load the subtitles for the second video automatically.