Extract subtitles from a video (mkv) file with a script

Hello everybody,

I checked a few threads concerning this issue, but all threads are either closed by now. Have dead links or don’t contain a link to a script or website at all.

I tried the script posted by user NewPlaza from this thread:

But it didn’t work for me, so I’m probably doing something wrong I guess. So if anybody has a script for this purpose that works. I would greatly appreciate if you share it here! :slight_smile:

Thanks in advance!

Thanks, but I’m a bit to noob to make a script by myself… :open_mouth:

you don’t need a script…
Installing MKVToolNix on a Windows system will install their GUI App and the executables like mkvextract.
If you want to extract your subtitles:

  1. Open the Command Prompt (if you don’t know where to find it, click the Windows key and enter cmd, then click the match to open)
  2. CD (change directory) to the program folder of MKVToolNix
  3. Execute the mkvextract app:

Schema:

mkvextract "[path to the movie file]" tracks "[track number]:[Output File Name].srt"

Example:

mkvextract "Movie 1.mkv" tracks "2:Movie 1.srt"
Parameter Value
input file Movie 1.mkv
track number 2
output file Movie 1.srt

This assumes the files are in the same directory as the application; file name needs to be put in quotes if they include whitespace characters.

Keep in mind… this will only work if you’re dealing with a text based subtitle (such as SRT). You cannot export an image based subtitle as text – that requires some more sophisticated apps that support text recognition to convert the images (OCR).

If you don’t know which track/stream ID you’re looking for, you can open the source file in the MKVToolNix GUI by dragging&dropping it into the Header Editor… open the tree node of the applicable track, look for the Track number property… done

1 Like

There are also GUIs for mkvextract:

side note: your web browser appears to delete the cookies from plex.tv every time you close it.
Tell it to not do that, or your Plex web settings will revert every time, and you have to sign in every time as well.

I have the MKVToolNix GUI app installed, but I thought a script would be more convenient. That’s at least the idea I got from reading about people using these type of scripts.

I tried to extract a subtitle with the GUI version, but it took quite a while and I ended up with a .mks file. This was my first try without doing research, so I’ll have to look a bit deeper into it. I also tried with a program called ‘Subtitle Edit’, it did it quite a lot faster then MKVToolNix. But it could be because I chose the wrong output the first time.

This is my main browser I’m using now and I have Plex server open in another browser which does store cookies. So I guess that would be fine right?

I only see that you are creating lots of new browser authentications daily. Which is almost always a sign that your browser does delete the cookies after you close it.

There could be also browser add-ins doing this.

Yeah that’s because I used to open it in my main browser. Where I have a couple of plugins and deleting cookies after closing it. That’s why I’m now running it in a separate browser with no plugins and which doesn’t delete cookies. I always use at least two browsers anyway for this reason.

Are those new browser authentications a problem in some way? Although, like I said. That should be a thing of the past now…

No, if you already use a separate browser, all should be well from now on.

You might as well create some exception rules in the preferences of your browser add-ins.

Evening

I use the following in FFMPEG command line:

ffmpeg -i (filename).mkv -vcodec copy -acodec copy -sn (newfilename).mkv.

If I am doing multiple files I’ve created a batch file that does loads of files one after the other.
Very handy if doing TV series that you have messed the subs on.

Kind Regards

CCF

That sounds really nice, would you share that batch file with me? :slight_smile:

How do I do that?

Just copy the text from the batch file and paste it into the message composer of this forum.
Then add a separate line above and below the code with only 3 backticks (`) on it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.