Hi there
I’m hoping @mbunkus or someone else can help guide me in the right direction. I would really appreciate it.
For the past 5 months I have been subtitling a 75 episode Japanese anime and I am now at the end of the project. What I currently have:
It’s 75 folders that each contain an mkv, the corresponding .ass subtitle file, fonts and an xml chapter file. A look into one folder:
I want to mux all these files together into 75 different mkv files into a singular folder. I know I could do it manually but thought batch would limit any mistakes.
Things I want done:
1: In mkvtoolnix gui, each mkv file I have as the source is video with id 0 and audio language is und with id 1 (both default tracks). I just want to set the audio language to Japanese.
2: For the subtitle file, set the language to English and have the name of the subtitles set to E-F Restoration. However, once getting to folder 40 and onwards, change this to R-F Restoration.
3: The output files should have a naming convention of [E-F Restoration] Hikaru no Go 01.mkv, 01 is the name of the corresponding folder but like point 2, change this starting episode/folder 40 to [R-F Restoration] Hikaru no Go 40.mkv (so as an example the very last file should also be named [R-F Restoration] Hikaru no Go 75.mkv)
4: Fonts needing attached are either ttf otf ttc filetypes.
5: Put the output mkvs into a different folder called Done or similar.
I tried to see if AI would do it and each time it gave me different solutions. One such example:
@echo off
setlocal enabledelayedexpansion
set “BASE=%~dp0”
set “OUT=%BASE%Done”
if not exist “%OUT%” mkdir “%OUT%”
for /L %%I in (1,1,75) do (
rem Format folder number as 2 digits
set "EP=0%%I"
set "EP=!EP:~-2!"
set "FOLDER=%BASE%!EP!"
rem Get input files
for %%F in ("!FOLDER!\*.mkv") do set "MKV=%%F"
for %%F in ("!FOLDER!\*.ass") do set "SUB=%%F"
rem Skip if missing main file
if not defined MKV (
echo Skipping episode !EP! - no mkv found
goto :next
)
rem Decide naming + subtitle title
if %%I LSS 40 (
set "STYLE=E-F Restoration"
) else (
set "STYLE=R-F Restoration"
)
set "OUTFILE=%OUT%\[!STYLE!] Hikaru no Go !EP!.mkv"
echo Muxing Episode !EP!...
mkvmerge -o "!OUTFILE!" ^
--language 0:jpn ^
--track-name 2:"!STYLE!" ^
--language 2:eng ^
"!MKV!" ^
"!SUB!" ^
--attachment-mime-type application/x-truetype-font "!FOLDER!\*.ttf" ^
--attachment-mime-type application/vnd.ms-opentype "!FOLDER!\*.otf" ^
--attachment-mime-type application/x-truetype-font "!FOLDER!\*.ttc"
:next
)
echo Done.
pause
Is something like this remotely close? Honestly I’m too scared to run anything so far as I don’t want to mess up the file/folder structure. If anybody knowledgeable could look at this to do a script I would be really grateful.

