I am having some problems setting up a bash script to automate some stuff.

What is my problem: I ripped all my BluRays to set up a personal media server (e.g. Emby) for my family. Unfortunately, my files include a lot of VOBSUB or PGS subs which aren't very compatible. Due to that, I want to convert them to SUBRIP.

So, I need to:

  1. Extract present subs (MKVToolNix -> mkvextract
  2. Convert PGS -> SUB (BDSup2Sub)
  3. Convert SUB -> SRT (VobSub2SRT)

For the first point I found a script in the www, which I now am trying to expand by point two and three.

This is what I currently have: https://pastebin.com/LVxWQ7QM

When there is only one SUP file in the folder the script works perfectly file, once there is a second one the check in line 273 does not work anymore. Example: In a folder are abc.ger.sup and xyz.eng.sup

In line 273 $SRTNAME= xyz.eng.sup and therefore the check does not work.

Hope it is somehow clear what I mean, if not please let me know.

Any hint is appreciated. Thank you!


  • script is gone. – emk2203 Oct 27 '20 at 17:05

very simple and effective oneliner i use to convert subtitles:

for i in *.ass ; do ffmpeg -i "$i" "$i.srt" ; done

just change ass and srt according to your needs.

  • Afaik and from my testing ffmpeg does not support graphical conversion of subs, which is really unfortunate. – neik Feb 7 '20 at 20:04
  • @neik if you have a windows pc laying around somewhere, you can create a batch script from the solution here: github.com/SubtitleEdit/subtitleedit/issues/2444 – RASG Feb 7 '20 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.