Search for words in the SRT subtitle files of your videos playing in VLC.
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.
Check releases to download a specific version.
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\
- All users:
- 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/
- All users:
- Linux
- All users:
/usr/lib/vlc/lua/playlist/ or /usr/share/vlc/lua/extensions/
- Current user:
~/.local/share/vlc/lua/extensions/
- All users:
- 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.
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.
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.
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.
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.
The following images were taken for v1.1, but the current interface is similar.
- The extension was created using the VLC Lua guide in this specific version:
- README.txt
- You can check the history of the file to track changes in the API.
- The VLC forum is useful to solve doubts about plugin development.
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