I hope this can help you in automating the process. This code converts .mp4 video and .srt subtitles files to .mkv file with embedded subtitles.
Batch file.
Just drop 2 files on it at the same time - .mp4 and .srt to get a .mkv video with embedded subtitles.
If you want the original/low video quality, just comment/uncomment the appropriate line in the code.
Among all other things, I made an asynchronous call of msgBox. Who needs it - copy it to your sources.
For some reason, it doesn't accept parentheses () in file names. I did not check the rest of the characters.
@echo off
if "%~x1"==".mp4" (
set mp4=%~n1
set path=%~d1%~p1
)
if "%~x2"==".mp4" (
set mp4=%~n2
set path=%~d1%~p1
)
if "%~x1"==".srt" set srt=%~1
if "%~x2"==".srt" set srt=%~2
if not "%mp4%"=="" (
if not "%srt%"=="" (
:: If your original ffmpeg.exe file located in system32 directory then replace "%~dp0ffmpeg.exe" to ffmpeg
:: original quality
::"%~dp0ffmpeg.exe" -i "%path%%mp4%.mp4" -i "%srt%" -ar 48000 -vcodec libx264 -disposition:s:0 default -scodec copy "%path%%mp4%.mkv"
:: low quality
"%~dp0ffmpeg.exe" -i "%path%%mp4%.mp4" -i "%srt%" -ar 48000 -ab 128k -ac 2 -vcodec libx264 -s 480x240 -b 256k -disposition:s:0 default -scodec copy "%path%%mp4%.mkv"
call :msgbox "File %path%%mp4%.mkv completed."
) else call :msgbox "File .srt missing in the input parameters`r`nJust drop 2 files with extensions:`r`n.mp4 - video and .srt - subtitles`r`nto this batch file to get .mkv with subtitles"
) else call :msgbox "File .mp4 missing in the input parameters`r`nJust drop 2 files with extensions:`r`n.mp4 - video and .srt - subtitles`r`nto this batch file to get .mkv with subtitles"
goto :eof
:msgBox [msgText]
C:\Windows\System32\mshta.exe vbscript:Execute("CreateObject(""WScript.Shell"").Run ""powershell -Command """"[Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')|Out-Null;"""" """"[System.Windows.Forms.MessageBox]::Show(\""""%~1\"""")"""""",0,false:close")
exit /B