Between Linux and Anime

Kind of like Schrodinger's Cat

Playing Multiple Subtitles Simultaneously with Mplayer

Well, with any player that plays ass subs really, but the procedure requires Mplayer :)

(I know I haven’t written a real post in a good while and this doesn’t quite count. I’ll post soon! I hope.. at least, I’m positively definitely trying to really write a proper post and push it out as soon as I’m positively capable of doing. No really!)

So I found myself needing to have both english and chinese subtitles on at once today and struggled with it briefly. I eventually found the solution in the form of a script called merge2ass (Source). What it does is it takes two different subtitle files and smushes it into a single ass file that basically shows the first subtitle file at the top of the screen and the second subtitle file at the bottom, something like this:

Yuki is sad all this is harder than she wanted

Usage of the script is simple enough. Make it executable, then supply the video file, the first subtitle file, then the second. You can also just run the script without arguments and it’ll show a nice help message.

chmod +x merge2ass.sh
./merge2ass.sh yourmoviefile.format sub1.srt sub2.srt

This will produce a file called yourmovilefile-bilingual.ass that you could then load with mplayer (or whatever other player you want) to get simultaneous dual subtitles.

Oh right, for this to work with chinese subtitles, you need to change line 125 and/or 128 of the script and supply -subcp enca:zh:BIG5 as an mplayer option, as per this post. Just add it immediately after ‘mplayer’, like so:

mplayer -subcp enca:zh:BIG5 -dumpsrtsub -noautosub -really-quiet -frames 0 -sub "${sub[1]}" "$movie" 2>>"$mplayer_err" && echo "Done"

1287
Rate this post
Thanks!
An error occurred!


  • Facebook
  • Twitter
  • Identi.ca
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • RSS
  • Reddit

Previous

The Clannad Basketball Match: VN vs Anime

Next

Spring 2013 Brainmarks (Simplified)

77 Comments

  1. I was tricked. The image made me think this was a Ookami Kodomo no Ame to Yuki post!

  2. Jason "moofang"

    Haha! I want to write on that show. It was great.

  3. It really was great. It hit all the right places. They were so cute as kids.

  4. deyu260

    大中华崛起了?这动画不是日本的?

  5. tidak bisa mendapatkan pengaturan web yang tepat

  6. innn

    hi, what am I doing wrong that I get this:
    merge2ass.sh edukators_1.avi edukators_1.srt edukators_1_de.srt
    Processing..
    mplayer ist /usr/bin/mplayer
    Converting the 1st subtitle file (edukators_1.srt) to a time-based format...
    Done
    mv: der Aufruf von stat für »dumpsub.srt“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
    Converting the 2nd subtitle file (edukators_1_de.srt) to a time-based format...
    Done
    mv: der Aufruf von stat für »dumpsub.srt“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
    sed: kann edukators_1.srt-temp nicht lesen: Datei oder Verzeichnis nicht gefunden
    sed: kann edukators_1_de.srt-temp nicht lesen: Datei oder Verzeichnis nicht gefunden
    rm: das Entfernen von »edukators_1.srt-temp“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
    rm: das Entfernen von »edukators_1_de.srt-temp“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden

    • innn

      I am sorry that was in german. Basically it says “mv:calling for dumpsub.srt not possible: file or folder not found”
      sed: couldn’t read first.srt-temp: not found
      sed: couldn’t read second.srt-temp: not found
      rm:deleting *-temp not possible: not found

      I have to say that I get a *-bilingual.ass file though but it’s not showing anything in smplayer.

      • Jason "moofang"

        Looks like the mplayer commands are not running correctly. You can change the value of mplayer_err to something else: look for the following lines inside the script:

        #mplayer_err=/dev/stderr
        mplayer_err=/dev/null

        Uncomment the first and comment out the second, then run the script again and check for additional error messages.

  7. innn

    @Jason
    thank you for such quick answer. I get the same errors by editing that.
    Basically what happens is this:
    Converts the 1st to a time-based format…
    Done
    But when must it move the dumpsub.srt file (it’s in the code) it says not found.
    Converts the 2nd …Done. Moving not as it doesn’t exist.
    Then twice sed command complains not founding these files:${sub[1]}-temp and ${sub[2]}-temp
    followed by rm complaint that cannot remove them as they don’t exist.

    If it helps somewhat I run it on Ubuntu 13.10 x64

    • Jason "moofang"

      Hmmm, what happens is that the mplayer commands are supposed to produce the dumpsub.srt files that the mv command then renames. The mv command complaining means dumpsub.srt was not produced, meaning something went wrong with the mplayer commands. Maybe /dev/stderr isn’t a visible stderr on ubuntu. Try running the mplayer command directly:

      mplayer -dumpsrtsub -noautosub -really-quiet -frames 0 -sub sub1.srt yourmoviefile.format

      And see if you get any useful info? This command should produce a dumpsub.srt in the current folder.

      • innn

        I’ve tried it:
        mplayer -dumpsrtsub -noautosub -really-quiet -frames 0 -sub edukators_1.srt edukators_1.avi
        and I got only this:
        mplayer: could not connect to socket
        mplayer: No such file or directory
        Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory

        No dumpsub.srt file there.

        • Jason "moofang"

          Hmmm, it looks like it is trying to use VDPAU but VDPAU isn’t installed on your system. Do you normally play videos with mplayer and do they normally work?

          Try telling it to use another backend:

          mplayer -vo xv -dumpsrtsub -noautosub -really-quiet -frames 0 -sub edukators_1.srt edukators_1.avi

          See if that makes a difference? You can also get a list of available backends with

          mplayer -vo help

          In case xv has any issues as well.

          Fixed your comment code blocks btw.

          • innn

            Ok I tried with -xv still no outcome. I only get htis now:

            mplayer: could not connect to socket
            mplayer: No such file or directory

  8. innn

    wait a minute I got it , I disabled LIRC in .mplayer/config
    with this line : nolirc=yes
    run the command and voila there was no error and the dumpsub.srt sitting inside the directory.
    I’ve just run again merge2ass.sh and the *.ass file is there and working.
    Sorry to have bothered all this time and thank you once again . Still in shock because of that lirc support mplayer wouldn’t dump the sub file. Nasty thing.
    Best regards.

  9. deon

    Hello:

    I’m trying FreeBSD on VMware virtual machine, on a HP PC model with Intel architecture 64bist. Install Mplayer and I can not install the codecs, someone help?.

    Note:
    SVN stops and does not work.
    Thank you.

  10. Kerim

    Use KMPlayer instead of combining two subtitle. It can show up to three subtitles simultaneously. My settings can be recognized two subtitles automatically. I only click the video file.

  11. Goncalo

    Please how can I get the same in Windows?

  12. Marc

    Peope who are showing both subtitles at the bottom, do not forget to pass -ass option to mplayer!! :)

  13. Marc

    Thanks a lot.

    Here it is a script to run it with just:

    mplayer2 video sub1 sub2 [margin] [extra-mplayer-params]

    https://gist.github.com/waiting-for-dev/017d31eee21c08641687

  14. I tried this some time ago and it was not useful for some players (ASS format is not widely accepted yet).
    For that reason I created and released a tool to merge and translates SRT subtitles: DualSub (http://dualsub.sourceforge.net/) . This tool works with SRT subtitles for input and output. It has many options for customization. In addition you can use it to translate subtitles to any language.
    Enjoy!

  15. Use KMPlayer instead of combining two subtitle. It can show up to three subtitles simultaneously.

  16. On other website for dual subtitles : http://www.dualsubtitles.com/ The advantage for this website is : compatibility with Kodi (XMBC) and automatic detection/conversion of the files encoding to UTF-8.

  17. Great tip, was initally using greanfish subtitle player but it shows on a separate window. Guess this one does the trick.

  18. Thanks for that tip Jason.
    It worked for me too

  19. Great tip, was initally using greanfish subtitle player but it shows on a separate window. Guess this one does the trick.

  20. lol in image she looks like Ookami Kodomo :D

  21. lol in image she looks like Ookami Kodomo :D

  22. Peope who are showing both subtitles at the bottom, do not forget to pass -ass option to mplayer!! :)

  23. keep it up nice article.

  24. New business cannabis and CBD loans. 680+ FICO needed to quality.

  25. Thank you so much for sharing this information, this will surely help me in my work and therefore,

  26. Annabellaagrib

    Hello to all
    In this puzzling time, I honey you all
    Appreciate your relations and friends

  27. Great, thanks tips :D

  28. wow. so excellent blog and post .
    really enjoy it ,thanks for sharing you post .
    really awesome and nice write up .
    great post ! great post !
    thumbs up!

  29. wow. so excellent blog and post .
    really enjoy it ,thanks for sharing you post .
    really awesome and nice write up .
    great post ! great post !
    thumbs up!

  30. Everything is very open with a precise explanation of the issues. It was definitely informative. Your site is very useful. Many thanks for sharing!|

  31. Juanitalep

    , .

    , .

  32. 50mg kamagra without a doctor prescription otc kamagra buy kamagra online canada pharmacy

  33. Hello everyone , I’m Austin Hawes.
    Welcome to my website . I started writing in high school after a creative writing assignment for my English teacher. I did creative writing for almost a year before I thought about doing something else.
    I had always loved doing research assignments because I’m passionate about learning. When you combine writing skill with a love of learning, academic writing only makes sense as a job.
    I’m passionate about aiding the students of the future in their school career. When they get too busy, I am there to help.

    Austin Hawes – Professional Academic Writer – http://www.andersnordberg.com Company

  34. Hi Everybody
    Thanks for checking out my academic writing page . My name is Kyran.
    I have worked a long time in this niche. My passion for writing started at a young age. I wrote poetry as a child and eventually went on to work with my school newspaper.
    This early tryst into journalism eventually led me to academic writing. There is plenty of work for qualified writers. I specialize in research papers , but have the skills to do all types of academic writing.
    Contact me for more information about rates and a price quote. I’m looking forward to helping you.

    Academic Writer – Kyran – Killer Papers Company

  35. I don’t like, it’s bad.

  36. Bookmarked, really like it.

  37. great points altogether, you simply gained a brand new reader. What would you suggest about your post that you made some days ago? Any positive?

  38. My name is Leonard. And I am a professional academic writer with many years of experience in writing.

    My goal is to solve problems related to writing. And I have been doing it for many years. I have been with several associations as a volunteer and have assisted in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a passionate writer who started at an early age.
    I’m happy that I`ve already sold several copies of my poems in different countries like France and others too numerous to mention.
    I also work in an organization that provides assistance to many students from different parts of the world. Clients always come to me because I work no matter how complex their projects are. I help them to save energy, because I feel fulfilled when people come to me for professional help.

    Ghost Writer – Leonard Rossi – http://www.asadeaguia.net Band

  39. Cool site, cheers for your time

  40. Thank you for this excellent post. Very informative!
    Kiss918 is arguably the most prominent online casino in Malaysia, bringing you the hottest, top trending games on the internet, all in one destination. 918 Kiss has all sorts of entertainment content, ranging from fishing games and live table games to one of our main attractions that is slot games.

  41. Such outstanding post is simply unbelievable! Keep posting!
    language centre in petaling jaya is strive to deliver the best linguistic services to our clients. Based in Petaling Jaya, Ringo has been providing the finest quality of learning experience and translation services for corporate clients and language learners since 1999.

  42. Good day and welcome to my blog . I’m Nannie.
    I have always dreamed of being a writer but never dreamed I’d make a career of it. In college, though, I aided a fellow student who needed help. She could not stop telling me how well I had done. Word got around and someone asked me for writing help just a week later. This time they would pay me for my work.
    During the summer, I started doing research paper writing for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing services to students.

    Writing Specialist – Nannie Morris – http://www.queronaao.com Band

  43. Hi, I am Reema a professional in content writing.

    I enjoy solving people’s problems and make them happy. That is what I have been doing for many years now.
    I have been writing since I was 12 years old and never knew it would turn out to be a full-time career. I have also been able to manage several projects that involves writing. And I worked in three organizations as a volunteer to assist people.My hobbie has always been to help people succeed. And I go the extra mile to make that happen.
    I enjoy writing books and have helped people from countries like China.
    I work with a company whose mission is to provide quality papers and make people happy. In fact, many people come to me for help on a daily basis because they know I always deliver. And I will continue to provide nothing but quality to build trust like I have been doing for the past few years.

    Expert writer – Reema Bright – http://www.leadershipeducationnelenhaiti.comCorps

  44. Thanks for visiting,
    I’m Eduard.
    If you’ve ever been too busy and couldn’t finish a research assignment , then you’ve come to the right place. I work with students in all areas of the writing steps . I can also write the essay from start to finish.
    My career as a professional writer started during high school. After learning that I was very able in the field of academic writing, I decided to take it up as a career .

    Talented Academic Writer- Eduard- simonnejones.org Team

  45. Welcome to my blog ,
    I’m Kyran Mckinney.
    If you’ve ever been too tired and couldn’t finish a academic paper, then you’ve come to the right place. I work with students in all areas of the writing technique. I can also write the paper from start to finish.
    My career as an academic writer started during my school years . After learning that I was very capable in the field of academic writing, I decided to take it up as a profession.

    Talented Academic Writer- Kyran- http://www.aa-mediastudies.net Team

  46. Thank you for this excellent post. Very informative!
    kiss918 is arguably the most prominent online casino in Malaysia, bringing you the hottest, top trending games on the internet, all in one destination. 918 Kiss has all sorts of entertainment content, ranging from fishing games and live table games to one of our main attractions that is slot games.

  47. Thanks for visiting,
    I’m Adnan Underwood.
    If you’ve ever been too busy and couldn’t finish a academic paper, then you’ve come to the right place. I work with students in all areas of the writing process . I can also write the assignment from start to finish.
    My career as an academic writer started during my school years . After learning that I was very talented in the field of academic writing, I decided to take it up as a profession.

    Professional Academic Writer- Adnan Underwood- Write My Essay For Me, Please! – These Websites Will Help Company

  48. Good day and welcome to my webpage. I’m Camden Patton.
    I have always dreamed of being a novelist but never dreamed I’d make a career of it. In college, though, I aided a fellow student who needed help. She could not stop telling me how well I had done. Word got around and someone asked me for to help them just a week later. This time they would compensate me for my work.
    During the summer, I started doing research paper writing for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing services to students.

    Professional Writer – Camden – http://www.heartbeatsmovement.com Company

  49. Hello ,
    I’m Preston.
    If you’ve ever been overscheduled and couldn’t finish a research assignment , then you’ve come to the right place. I work with students in all areas of the writing technique. I can also write the assignment from start to finish.
    My career as an academic writer started during high school. After learning that I was very able in the field of academic writing, I decided to take it up as a job .

    Professional Academic Writer- Preston- studentenkamerbrugge.comCorps

  50. My name is Preston Singh. And I am a professional academic writer with many years of experience in writing.

    My main focus is to solve problems related to writing. And I have been doing it for many years. I have been with several organizations as a volunteer and have assisted in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a full-time writer who started at an early age.
    I’m happy that I`ve already sold several copies of my books in different countries like Canada and China and others too numerous to mention.
    I also work in a company that provides assistance to many students from different parts of the world. Students always come to me because I work no matter how difficult their projects are. I help them to save energy, because I feel fulfilled when people come to me for professional help.

    Academic Writer – Preston Singh – nametheschool.comCorps

  51. Pussy888 is the best online casino platform for casino players in Malaysia, Singapore, Thailand, and Indonesia. Many options will make you feel a bit dizzy in Pussy888 APK. If you’ve tried any of the online casino websites, you might love them all!
    https://www.aibet711.com/

  52. Great work on the subtitles, that helped a lot!

  53. Cool site, supports your time

  54. Great article, enjoyed reading it. It helped me to save a lot of time. Thanks!!!

  55. One of the best articles about this topic. Well done

  56. Very captivating, I appreciate it!

  57. Purchase verified PayPal accounts, reloadable VCC,
    Revolut verified accounts, bet365, and ads account at visavcc.com.
    Trustworthy and reliable services for your online transactions.
    Boost your business today!

  58. Very good article. Well done

  59. Thank you for the article. It was interesting to read

  60. Thank you for the article. It was interesting to read

  61. Das ist eine super hilfreiche Anleitung! Vielen Dank, dass du die Schritte so klar beschrieben hast. Das Zusammenführen von Untertiteln kann wirklich knifflig sein, und die Lösung mit dem merge2ass-Skript ist genial. Ich finde es toll, dass du auch auf die speziellen Anforderungen für chinesische Untertitel hingewiesen hast – das macht den Prozess für viele Nutzer viel einfacher. Ich freue mich schon auf deinen nächsten Beitrag! Es ist immer spannend, von deinen Erfahrungen zu lernen!

Leave a Reply

Powered by WordPress & Theme by Anders Norén