Skip to content

Interactive subtitles for mpv. Instantly translate selected word/sentence.

License

Notifications You must be signed in to change notification settings

ewnd9/intersubs

 
 

Repository files navigation

intersubs

oltodosel/interSubs fork

Interactive subtitles for mpv, that was made to help study languages.

Easily tweaked and customizable.

z 00_00_5 75-00_00_19 96

    00:02:23,046 --> 00:02:25,990
    bla bla
    00:02:28,020 --> 00:02:33,084
    waka waka

    00:02:23,046 --> 00:02:28,020
    bla bla
    00:02:28,020 --> 00:02:33,084
    waka waka

Requirements

  • mpv 0.27 (I don't know if it will work with mpv front-ends.)
  • python => 3.6
  • pyqt5 (pip/pacman/etc)
  • composite manager; xcompmgr or sth.
  • numpy (pip/pacman/etc)
  • beautifulsoup4 (pip/pacman/etc)
  • requests (pip/pacman/etc)
  • python-lxml
  • lua
  • socat
  • pkill
  • xdotool (for hiding subtitles when minimizing mpv or switching window)
  • optional: chromium (for external translation, other browser can be specified)
  • optional: wget (for listening to pronunciation)

Installation

$ ./install.sh
  • Edit configuration file interSubs_config.py
  • Edit interSubs.lua to add option where interSubs will start automatically.
  • For Mac also edit configuration at interSubs.lua
  • On KDE(kwin) go to composite and uncheck "Allow applications to block compositing". Screenshot.
  • For Windows - port it yourself.

Usage

  • Start video with mpv & select subtitles.
  • F5 to start/stop interSubs.
    • Starts automatically with files/paths specified in interSubs.lua
  • Point cursor over the word to get popup with translation.
  • F6 to hide/show without exiting.

Buttons bellow may be reassigned in config

  • Click on the word to look it up on another translator in the browser.
  • Right-click on the word to hear its pronunciation.
  • Wheel - scroll through transitions in popup.
  • Wheel+Ctrl - resize subtitles.
  • Wheel+Shift - change subtitles' vertical position.
  • Wheel-click - cycle through auto_pause options.
  • Wheel-click-left/right - +/- auto_pause_min_words. (fancy mouses)
  • Back-click - translate whole sentence. (fancy mouses)

Important

  • May have issues working in a multi-monitor system. See the solution.
  • On KDE subtitles might sometimes be invisible. See the solution.
  • Instead of changing system settings you may change --x11-bypass-compositor
  • Stuttering video during subtitles change might be solved by changing mpv's video output mpv --vo gpu.

Testing

$ echo "hello world" > /tmp/intersubs-test.txt
$ python3 intersubs/intersubs.py whatever /tmp/intersubs-test.txt testing

About

Interactive subtitles for mpv. Instantly translate selected word/sentence.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.5%
  • Lua 4.5%
  • Other 1.0%