I think your issue is probably that as MKV can have subtitles embedded, all the splitters are assuming that these are the only subtitles.
I've run together a minor script based on my MKV muxer, that'll find & embed any .srt or .idx files with the same name as your current file:
using System;
using System.Windows.Forms;
using System.IO;
using System.Drawing;
using System.Data;
using System.ComponentModel;
using System.Collections;
//css_reference MediaCenter.dll;
class Script : MarshalByRefObject
{
const bool autoupdate=false;
const bool deletefiles=false;
public string GetTempPath()
{
string path = System.Environment.GetEnvironmentVariable("TEMP");
if (!path.EndsWith("\\")) path += "\\";
return path;
}
public void LogMessageToFile(string msg)
{
System.IO.StreamWriter sw = System.IO.File.AppendText(
GetTempPath() + "MKVMux_log.txt");
try
{
string logLine = System.String.Format(
"{0:G}: {1}.", System.DateTime.Now, msg);
sw.WriteLine(logLine);
}
finally
{
sw.Close();
}
}
public void Init(MediaCenter.MCAutomation mediaCenterInterface)
{
//Start logging
LogMessageToFile("Subs Muxing started");
//Get the current playing now playlist
MediaCenter.IMJCurPlaylistAutomation playlist = mediaCenterInterface.GetCurPlaylist ( );
//Iterate through all the files in the playlist
for (int counter = 0; counter < playlist.GetNumberFiles() ; ++counter)
{
//Get the file from the current position in the playlist
MediaCenter.IMJFileAutomation track = playlist.GetFile(counter);
string Extension= track.Filetype;
//Check the file's format- We can only mux subs into MKVs.
if (Extension == "mkv")
{
//Mux subs into the current MKV
System.Console.WriteLine("Needs muxing!");
System.Console.WriteLine("Looking for subtitles");
{
string subscheck=track.Filename;
subscheck= subscheck.Replace(".mkv",".srt");
string subscheck2=track.Filename;
subscheck2= subscheck2.Replace(".mkv",".idx");
if (File.Exists(subscheck))
{
//MKV Merge- With SRT Subs
string part1A=track.Filename;
string part2A="\"";
string part3A=" -o ";
string part4A=".mkv ";
string part5A=" ";
string subs=track.Filename;
subs= subs.Replace(".mkv",".srt");
string fileNameA=
string.Concat(part3A,part1A,part4A,part1A,part5A,subs);
fileNameA= fileNameA.Replace(".mkv.mkv","-subs.mkv");
//Launch MKV Merge
System.Console.WriteLine("Launching MKV Merge.....");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "mkvmerge.exe";
//Pass the argument we constructed earlier
proc.StartInfo.Arguments = fileNameA;
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();
//The MKV file has been created sucessfully- Print its path
System.Console.WriteLine(fileNameA);
System.Console.WriteLine("Muxed successfully!");
string fileName2= ("Muxed sucessfully!");
string fileName3=
string.Concat(part1A,fileName2);
LogMessageToFile(fileName3);
goto dbupdate;
}
if (File.Exists(subscheck2))
{
//MKV Merge- With IDX Subs
string part1A=track.Filename;
string part2A="\"";
string part3A=" -o ";
string part4A=".mkv ";
string part5A=" ";
string subs=track.Filename;
subs= subs.Replace(".mkv",".idx");
string fileNameA=
string.Concat(part3A,part1A,part4A,part1A,part5A,subs);
fileNameA= fileNameA.Replace(".mkv.mkv","-subs.mkv");
//Launch MKV Merge
System.Console.WriteLine("Launching MKV Merge.....");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "mkvmerge.exe";
//Pass the argument we constructed earlier
proc.StartInfo.Arguments = fileNameA;
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();
//The MKV file has been created sucessfully- Print its path
System.Console.WriteLine(fileNameA);
System.Console.WriteLine("Muxed successfully!");
string fileName2= ("Muxed sucessfully!");
string fileName3=
string.Concat(part1A,fileName2);
LogMessageToFile(fileName3);
goto dbupdate;
}
else
{
//No subs found- Nothing to do.
goto dontmux;
}
dontmux:
LogMessageToFile("No subs were found- Nothing to do");
}
dbupdate:
//Determines what to do with the original file.
//If autoupdate is set to true, then the original
//file will be renamed or deledted.
if (autoupdate==true)
{
//If deletefiles is set to true, the original file will be deleted.
//Otherwise, it will be renamed to .bak
if (deletefiles==true){
string deleteFile=track.Filename;
System.IO.File.Delete(deleteFile);
string deleteFile1=" has been deleted";
string deleteFile2=
string.Concat(deleteFile,deleteFile1);
LogMessageToFile(deleteFile2);
string deleteFile3=track.Filename;
deleteFile3= deleteFile3.Replace(".mkv",".srt");
deleteFile3= deleteFile3.Replace(".mkv",".idx");
System.IO.File.Delete(deleteFile3);
string deleteFile4=
string.Concat(deleteFile,deleteFile3);
LogMessageToFile(deleteFile4);
}
else
{
string trackFileBak1=track.Filename;
string trackFileBak2=track.Filename;
trackFileBak2= trackFileBak2.Replace(".mkv",".mkv.bak");
System.IO.File.Move(trackFileBak1, trackFileBak2);
string trackFileBak3= ("has been renamed to ");
string trackFileBak4=
string.Concat(trackFileBak1,trackFileBak3,trackFileBak2);
LogMessageToFile(trackFileBak4);
string trackFileName=track.Filename;
trackFileName= trackFileName.Replace(".mkv","-subs.mkv");
track.Filename = trackFileName;
string filetype = "mkv";
track.Filetype= filetype;
System.Console.WriteLine(trackFileName);
string trackFileBak5= ("Your database has been modified to point to the new MKV");
string trackFileBak6=
string.Concat(trackFileBak1,trackFileBak5);
LogMessageToFile(trackFileBak6);
}
}
if (autoupdate==false)
{
//If autoupdate is set to false, you will be prompted each time.
//Answering "No" will produce a new MKV which is not in the library
{
DialogResult reply = MessageBox.Show("Modify the database?",
"Do you want to modify the database to point to the new MKV?",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (reply == DialogResult.Yes){
if (deletefiles==true){
string deleteFile=track.Filename;
System.IO.File.Delete(deleteFile);
string deleteFile1=" has been deleted";
string deleteFile2=
string.Concat(deleteFile,deleteFile1);
LogMessageToFile(deleteFile2);
}
else{
string trackFileBak1=track.Filename;
string trackFileBak2=track.Filename;
trackFileBak2= trackFileBak2.Replace(".mkv",".mkv.bak");
System.IO.File.Move(trackFileBak1, trackFileBak2);
string trackFileBak3= ("has been renamed to ");
string trackFileBak4=
string.Concat(trackFileBak1,trackFileBak3,trackFileBak2);
LogMessageToFile(trackFileBak4);
}
string trackFileName=track.Filename;
string trackFileName1=track.Filename;
trackFileName= trackFileName1.Replace(".mkv","-subs.mkv");
track.Filename = trackFileName1;
string filetype = "mkv";
track.Filetype= filetype;
System.Console.WriteLine(trackFileName1);
string trackFileBak5= ("Your database has been modified to point to the new MKV");
string trackFileBak6=
string.Concat(trackFileName,trackFileBak5);
LogMessageToFile(trackFileBak6);
} else {
LogMessageToFile("Muxing was completed, but your database has not been modified at this time");
}
}
}
}
}
}
}
Overview:This script uses MrChriZ's scripting plugin to mux subtitles (.srt or .idx) into any MKVs present in Playing Now.
A new file will be produced, with -subs at the end to distinguish it from the original file, so it would look like this:
test.mkv ==> test-subs.mkv & so on.
Please don't assume its ready for primetime/ use on a live library- Its not, so please test on non-critical data first! Again, my coding may not be the best, but I think just about everything works as intended.
Available variablesThese are the variables, which should be altered depending on how you want the script to run-
const bool autoupdate=false
true: The source AVI will be renamed to .bak or deleted (See below), and the new MKV will be inserted into the library (The filename has -subs inserted at the end, as you can't read & write an MKV at the same time).
false: You will be prompted as to whether to update the library with each muxed file. Choosing 'No' will leave the original file intact & in your library, regardless of whether you have selected to delete or rename files.
const bool deletefiles=true;
WARNING: SEVERE DATA DAMAGE/ LOSS POTENTIAL!!!
true: The source file will be deleted assuming a replacement is muxed.
false: Your original MKV file will be re-named to .bak & the subs will remain as-is. This is the default option, I'd advise only changing it if you are 100% sure things will work out fine
A detailed log file may be found in %temp%\MKVMux_Log.txt (This logs to the scripting plugin console as well, but the detailed log should give times, as well as being persistant)
Cheers
-Leezer-