Posted by
D. Thijssen
Thursday, 18 September 2014
Say, you have about 160 mkv files with a 160 seperate subtitles. Matroska is a container format which can hold multiple content such as video, chapters, subtitles and audio tracks. So it's much neater to have a single file for each film or episode.
Doing this manually, even using the mkvmerge job queue, is mind numbing and can take hours. Here's a relatively quick way of automatizing this.
Old situation
New situation
Prerequisite
Download and install MKVToolNix.Part 1
- Load the first mkv file and the srt file into mkvmerge GUI.
- Set the options as desired.
- Click Muxing.
- Click Show the command line.
- Modify the $mkvmergecommand variable in the PowerShell script below to math the parameters in the Current command line.
This is the command line you need to run in bulk with slightly different parameters, being the input and output files.
Part 2
- Modify the variables at the top of the script to reflect your situation.
- Run the script.
$directory = "M:\Downloads\Prison Break"
$mkvmergecommand =
[String]"""""C:\Program
Files\MKVToolNix\mkvmerge.exe"" -o
""%outputfile%""
""--forced-track"" ""0:no""
""-s"" ""0"" ""-D""
""-A"" ""-T""
""--no-global-tags"" ""--no-chapters""
""("" ""%srtinputfile%""
"")"" ""--language""
""0:eng"" ""--default-track""
""0:yes"" ""--forced-track"" ""0:no""
""--display-dimensions"" ""0:1280x720""
""--language"" ""1:eng""
""--default-track"" ""1:yes""
""--forced-track"" ""1:no""
""-a"" ""1"" ""-d""
""0"" ""-S"" ""-T""
""--no-global-tags"" ""--no-chapters""
""("" ""%mkvinputfile%""
"")"" ""--track-order""
""0:0,1:0,1:1"""""
$files =
Get-ChildItem $directory
-Filter "*.mkv"
| Sort Name
Foreach ($file
in $files)
{
$mkvinputfile = ($directory
-replace "\\", "\\")
+ "\\"
+ ($file.Name)
$srtinputfile = ($directory
-replace "\\", "\\")
+ "\\"
+($file.Name -replace
".mkv",
".srt")
$outputfile = ($directory -replace
"\\",
"\\") +
"\\" +($file.Name -replace ".mkv", "Merged.mkv")
$mergecommand = (($mkvmergecommand
-replace "%outputfile%", $outputfile)
-replace "%mkvinputfile%", $mkvinputfile)
-replace "%srtinputfile%", $srtinputfile
cmd
/c $mergecommand
}
Download MergeMKVSRT.ps1.
Not working for me :(
ReplyDeletePowershell kicking out errors
Try this: https://1drv.ms/u/s!AjBPRo9wXw9s2eg3AoRAwm2KGxJkwg
DeleteTo be copied to the folder containing the input files; you might need to tweak the part of the code that derives the filename of the .SRT from the .AVI's filename
This comment has been removed by a blog administrator.
ReplyDeleteHello My Name is Joni and I am glad to welcome you to my site. I am a Blogger by profession. This is where you will find so many tips and tricks for Crack any product that are Related to Download Crack Softwares.
ReplyDeleteMKVToolNix Crack
ReplyDeleteThank you so much for sharing this amazing informationhttps://www.fullcracked.org/mkvtoolnix-crack/
My response on my own website. Appreciation is a wonderful thing...thanks for sharing keep it up. MKVToolnix Crack
ReplyDeleteIt is the best website for all of us. It provides all types of software and apps which
ReplyDeletewe need. you can visit this website.
key4pc.com
iobit-smart-defrag-pro-crack
So nice I am enjoying for that post as for u latest version of this Security tool.
ReplyDeletemkvtoolnix
xmind-pro
avs-video-editor-crack
backup4all-pro-crack
driver-talent-pro-crack
After looking through a few blog articles on your website,
ReplyDeletewe sincerely appreciate the way you blogged.
PDF XChange Editor Plus Crack
Maxon Cinema 4D Studio Crack
REAPER Crack
PhpStorm Crack
AVS Video Editor Crack
HMA Pro VPN Crack