项目作者: radioxoma

项目描述 :
Extract and merge multilingual subtitles into one file
高级语言: Python
项目地址: git://github.com/radioxoma/langmix.git
创建时间: 2016-04-15T14:21:03Z
项目社区:https://github.com/radioxoma/langmix

开源协议:MIT License

下载


langmix

Create multilanguage subtitles by merging two SubRip SRT video subtitles into one.
The tool is handy for language learning. Both GUI and featured command line interfaces are available.

Subtitles from the first file will be shown at top (with smaller letters),
and subtitles from the second at bottom (with regular letters) of the screen.

General how-to

  1. Use extractors/langmix-extractsrt.sh to extract all subtitles from one video file as SubRip SRT
  2. Merge SRT subtitles with langmix (GUI or cli batch mode)
  3. Watch:
    • For MPV put merged SRT file along with movie
    • For VLC put merged SRT file along with movie or in the subfolder named “subtitles”, “subs” (default VLC folder). Choose the right one by pressing V.

Example 1. One movie

Simplest case: extract subtitles from one movie and merge them:

  1. $ mkdir subs
  2. $ ls
  3. Movie.mkv subs
  4. $ langmix-extractsrt.sh Movie.mkv subs
  5. $ ls subs
  6. Movie-1-rus.srt Movie-2-eng.srt
  7. $ langmix # If no parameters given, will show GUI file dialogs

Example 2. Batch processing for series

Extract subtitles from all video files:

  1. mkdir subs
  2. # For Linux
  3. find . -type f -iname "*.mkv" -exec langmix-extractsrt {} subs/ \;
  4. # Cygwin
  5. find . -type f -iname "*.mkv" -exec sh /cygdrive/c/dev/src/langmix/extractors/langmix-extractsrt.sh {} subs/ \;

Merge files, using filename mask (read langmix --help):

  1. $ cd subs
  2. $ langmix "True.Detective.s01e*720p-{3-rus:4-eng}.srt"

Installation

Windows

Consider installing msys2 or Cygwin enviroment along with choco.

  1. $ pip install https://github.com/radioxoma/heval/archive/master.zip

Linux

Tip: Archlinux AUR package langmix-git available.

  • langmix is written in pure python3 and uses tkinter for file dialogs
  • langmix-extractsrt.sh just a wrapper around ffmpeg

Install dependencies and use scripts without installation:

  1. $ sudo apt install git python3-tk python3-pysrt # Debian / Ubuntu
  2. $ sudo pacman -S git python tk python-pysrt # Archlinux
  3. $ git clone https://github.com/radioxoma/langmix.git
  4. $ cd langmix

Run the scripts as described above:

  1. $ python3 ./langmix/langmix.py
  2. $ sh ./extractors/langmix-extractsrt.sh movie.mkv .