Skip to content

Search for words of the current video SRT subtitle files in VLC

License

Notifications You must be signed in to change notification settings

tcrespog/vlc-subtitle-word-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vlc-subtitle-word-search

Search for words in the SRT subtitle files of your videos playing in VLC.

Synopsis

With this VLC extension you can search on web search engines the words displayed in the SRT subtitles of a video. This way you can look up online dictionaries to get translations, meanings, and others.

The extension is published at addons.videolan.org.

Versions

Check releases to download a specific version.

Installation

Copy the subtitle_word_search.lua file in one of the following directories depending upon your operating system, and the availability you want for other users:

  • Windows
    • All users: Program Files\VideoLAN\VLC\lua\extensions\
    • Current user: %APPDATA%\vlc\lua\extensions\
  • Mac OS X
    • All users: /Applications/VLC.app/Contents/MacOS/share/lua/extensions/
    • Current user: /Users/%your_name%/Library/ApplicationSupport/org.videolan.vlc/lua/extensions/
  • Linux
    • All users: /usr/lib/vlc/lua/playlist/ or /usr/share/vlc/lua/extensions/
    • Current user: ~/.local/share/vlc/lua/extensions/

Help

Usage

  • Open the extension clicking the "View > Subtitle Word Search" menu.
  • The extension looks for all the external .srt subtitle files located in the same directory of the video file and with the same name as it. Those are the same subtitles that VLC detects automatically.
    • Select a subtitle file from the dropdown widget and load it clicking the "Load" button (when the extension is opened, one subtitle file will be loaded by default).
    • The subtitle track synchronization delay is taken into account. Once you change it, click the "Load" button to apply it.
  • The split words corresponding to the current playing time of the movie are displayed in a list.
  • Transform the text checking the "Lower" (transform to lower case) or "Symbol" (keep punctuation symbols) boxes and clicking the "Transform" button. The transformations will be performed anyway for the previous/next subtitles.
  • Navigate through the subtitles behind or ahead of the current time clicking the "<<" or ">>" buttons respectively.
  • Jump to the location in the video of the subtitle you are viewing with the "Go" button.
  • Change the playing time, click the "Refresh" button and see the updated subtitles.
  • Select a word, select a search engine, and click the "Search" button.
    • The web content will be displayed in the box at the bottom. You can also open the query link in your browser by clicking the "Open in browser" link.
    • Sometimes, the style of some web pages is not rendered properly, you can try getting rid of the styles by removing the HTML <head> tag. Just check the "Remove styles" box before making a search.

Tips

Encode subtitle files as UTF-8

VLC extensions work better with UTF-8 encoded text. To make sure most of the special symbols of the file are displayed correctly make sure the subtitle file you load is encoded as UTF-8.

Add your custom search engines

Open the subtitle_word_search.lua with a text editor and modify the variable search_engines adding new entries as in the example below.

search_engines = {
	{name = "Wikitionary", url = "http://en.wiktionary.org/wiki/%s"},
	{name = "Wikipedia", url = "https://en.wikipedia.org/wiki/%s"},
	{name = "My search engine", url = "http://www.mysearchengine.url/%s"} --New search engine!
}

Make sure the search engine URL has the %s text in place of the query text.

Keep the extension open

While watching a movie, open the extension and keep it open. Whenever you want to look up a word: pause the video, check the extension, click the refresh button and make your search.

Use it to hide subtitles

You may not be interested in seeing the subtitles to help you practice your listening skills. You can disable the subtitles and use the extension to check just those sentences that you didn't get right.

Demonstration GIFs

The following images were taken for v1.1, but the current interface is similar.

Load another subtitle file

alt text

Navigate through the subtitles

alt text

Search for a word

alt text

Refresh the current time's subtitle

alt text

Contribution

  • The extension was created using the VLC Lua guide in this specific version:
  • The VLC forum is useful to solve doubts about plugin development.

Testing

There are some unit tests for the addon in the test/ directory. The tests are written using LuaUnit.

To run the tests, download and install Lua 5.1, and run the following command inside the test/ directory:

lua test.lua