VideoHelp Forum




+ Reply to Thread
Results 1 to 4 of 4
  1. I need to add two language audio tracks to several MKV files that already have their own original audio and several SRT subtitles.

    I wrote this command line to run it in a batch file.

    Code:
    @ECHO OFF
    
    chcp 65001
    
    set mkvmerge=M:\FS\NF\mkvmerge.exe
    set input=M:\FS\NF\Original
    set AESP=M:\FS\NF\AESP
    set AKOR2=M:\FS\NF\AKOR2
    set output=M:\FS\NF\New
    FOR %%f in ("%input%\*.mkv") DO (
    
    	"%mkvmerge%" --output ^"%output%\%%~nf.mkv^"	--language 0:und --default-track 0:yes	--language 1:kor --track-name ^"1:Coreano ^(NF HK version^)^" --default-track 1:yes --language 2:ara --language 3:ger --language 4:eng --language 5:fre --language 6:tur --language 7:vie --language 8:chi --track-name 8:Simplified --language 9:chi --track-name 9:Traditional ^"^(^" ^"%%f^" ^"^)^" --language 0:spa ^"^(^" ^"%AESP%\%%~nf_ESP.flac^" ^"^)^" --language 0:kor --track-name ^"0:Coreano ^(TV version^)^" ^"^(^" ^"%AKOR2%\%%~nf_KOR.flac^" ^"^)^" --track-order 0:0,0:1,0:2,0:3,0:4,0:5,0:6,0:7,0:8,0:9,1:0,2:0
    )
    PAUSE>NUL
    EXIT
    However, I only get a message like this in CMD.

    Code:
    mkvmerge v75.0.0 ('Goliath') 32-bit
    Error: The file 'M:\FS\NF\AKOR2\EP 01_KOR.flac' could not be opened for reading: open file error.
    I don't understand what the problem is. The paths are correct and even the filenames are simple and barely have a single space in the name, that's why I'm using quotes.
    Quote Quote  
  2. Remove the first line to help you see the problem.
    Last edited by jagabo; 15th Apr 2023 at 23:38.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    Remove the first line and you'll see the problem immediately.
    Although I removed the @ECHO OFF to see the full paths It took me a while to notice that there was a problem with the Korean language audio files after I tried muxing one language per session instead of both together.

    Code:
    M:\FS\NF>set mkvmerge=M:\FS\NF\mkvmerge.exe
    
    M:\FS\NF>set input=M:\FS\NF\Original
    
    M:\FS\NF>set AESP=M:\FS\NF\AESP
    
    M:\FS\NF>set AKOR2=M:\FS\NF\AKOR2
    
    M:\FS\NF>set output=M:\FS\NF\New
    
    M:\FS\NF>FOR %f in ("M:\FS\NF\Original\*.mkv") DO ("M:\FS\NF\mkvmerge.exe" --output "M:\FS\NF\New\%~nf.mkv" --language 0:und --default-track 0:yes      --language 1:kor --track-name "1:Coreano (NF HK version)" --default-track 1:yes --language 2:ara --language 3:ger --language 4:eng --language 5:fre --language 6:tur --language 7:vie --language 8:chi --track-name 8:Simplified --language 9:chi --track-name 9:Traditional "(" "%f" ")" --language 0:spa "(" "M:\FS\NF\AESP\%~nf_ESP.flac" ")" --language 0:kor --track-name "0:Coreano (TV version)" "(" "M:\FS\NF\AKOR2\%~nf_KOR.flac" ")" --track-order 0:0,0:1,0:2,0:3,0:4,0:5,0:6,0:7,0:8,0:9,1:0,2:0 )
    
    M:\FS\NF>("M:\FS\NF\mkvmerge.exe" --output "M:\FS\NF\New\EP 01.mkv" --language 0:und --default-track 0:yes      --language 1:kor --track-name "1:Coreano (NF HK version)" --default-track 1:yes --language 2:ara --language 3:ger --language 4:eng --language 5:fre --language 6:tur --language 7:vie --language 8:chi --track-name 8:Simplified --language 9:chi --track-name 9:Traditional "(" "M:\FS\NF\Original\EP 01.mkv" ")" --language 0:spa "(" "M:\FS\NF\AESP\EP 01_ESP.flac" ")" --language 0:kor --track-name "0:Coreano (TV version)" "(" "M:\FS\NF\AKOR2\EP 01_KOR.flac" ")" --track-order 0:0,0:1,0:2,0:3,0:4,0:5,0:6,0:7,0:8,0:9,1:0,2:0 )
    mkvmerge v75.0.0 ('Goliath') 32-bit
    Error: The file 'M:\FS\NF\AKOR2\EP 01_KOR.flac' could not be opened for reading: open file error.
    I had not noticed that in the file names there was a space in the middle of the number and underscore. Before opening this thread the files I was trying to mux had other longer names and even folders had other names, I made sure that everything could match to make it work and yet I had the same problem.
    Quote Quote  
  4. Hello again. I want to come back to this thread because I have this problem again.

    Unlike the previous case that was solved, now mkvmerge can open files despite having correctly assigned path variables and check that all files had the same names. I modified the batch file several times but still get the same error.

    Code:
    set extVID=.mkv
    set extAUD=.flac
    set mkvmerge=%~dpn1mkvmerge.exe
    set invid=%~dp1.\MKV
    set inaud=%~dp1.\AUDFLAC
    set chap=%~dp1.\CHAPTERS
    set outvd=%~dp1.\NEW
    FOR %%f in ("%invid%\*%extVID%") DO (
    
    	"%mkvmerge%" --output ^"%outvd%\%%~nf%extVID%^" ^
    		--language 0:und ^
    		^"^(^" ^"%%f^" ^"^)^" ^
    		--language 0:und ^
    		^"^(^" ^"%inaud%\%%~nf%extAUD%^" ^"^)^" ^
    		--chapters ^"^(^" ^"%chap%\%%~nf.txt^" ^"^)^" ^
    		--track-order 0:0,1:0
    )
    this appears when run it

    Code:
    mkvmerge v75.0.0 ('Goliath') 32-bit
    Error: Could not open '(' for reading.
    I made a batch file to mux with ffmpeg using similar variables and the file path (except add chapters because I don't know how to do it) is the same and it works.

    Code:
    set extVID=.mkv
    set extAUD=.flac
    set "ffmpeg=%~dpn1.\ffmpeg.exe"
    set entradaVID=%~dp1.\MKV
    set entradaAUD=%~dp1.\AUDFLAC
    set chapter=%~dp1.\CHAPTERS
    set salida=%~dp1.\NEW
    FOR %%V in (%entradaVID%\*%extVID%) do %ffmpeg% ^
      -i "%%V" ^
      -i "%entradaAUD%\%%~nV%extAUD%" ^
      -strict experimental ^
      -c:v copy ^
      -c:a copy ^
      "%salida%\%%~nV%extVID%"
    The code that I use in mkvmerge is the same as in the previous case, it cannot be that it doesn't work.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!