We watch a movie with subtitles in two languages ​​at once

    Having just seen this blog post on Habrahabr , I thought, is it possible to do so in Linux. It turned out - it is possible. Moreover, the method does not depend on the video player, the main thing is that the program supports subtitles in ASS format .

    Screenshot

    if anyone needs this, i created a bash script allowing you to
    watch / convert movies with two subtitles shown at the same time. you
    may use this if a foreign friend comes to visit you and you both would
    like to watch a movie with subtitles in your mother language, for
    instance.


    If someone needs it, I created a script on bash that allows you to watch / convert movies so that two subtitle tracks are displayed simultaneously. You can use it if, say, a friend from another country comes to visit you and you both would like to watch a movie with subtitles in your own language.


    [MPlayer-users] two subtitles at one time (script)

    I made two-line changes in the script by adding the -subcp utf-8 option to the SRT file conversion command.

    The script dependencies are mplayer (in case your subtitle files need to be converted to srt) and gnu utils (about the presence of gnu utils on the computer, something tells me, you can not worry).

    Save the merge2ass.sh script to your computer (link above).

    Now open the console and go to the directory in which the script is located.

    For example, like this:
    cd scripts / (while in the home directory)
    Or like this:
    cd ~ / scripts / (while somewhere else)

    Set the script the right to execute (done once):
    chmod + x merge2ass.sh

    Now let's see what arguments the script takes.

    1. Movie file
    2. Some subtitles
    2. Second subtitles
    4. An optional argument, maybe “-pm” or “--play-movie” to instantly switch to watching a movie

    So, download Russian and English subtitles.

    Russian subtitles are most likely encoded in CP1251. Change the encoding to UTF-8.

    iconv -f cp1251 -t utf-8 movies / lie_to_me-s02e11-russian.srt> movies / lie_to_me-s02e11-russian-utf-8.srt

    And run the script.

    ./merge2ass.sh movies / lie_to_me-s02e11.avi movies / lie_to_me-s02e11-english.srt movies / lie_to_me-s02e11-russian-utf-8.srt

    The script creates the file lie_to_me-s02e11-bilingual.ass. It remains to run the movie.

    mplayer -noautosub -ass movies / lie_to_me-s02e11.avi -sub movies / lie_to_me-s02e11-bilingual.ass -subcp utf-8

    Enjoy watching and, of course, learn languages!

    Also popular now: