VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Hi.

    I've been using MKVToolNix for a while, I know how to add an srt file to an mkv video and create a new file so that the sub file is no longer a separate one. But now I need to do that with about 50 files. Does someone know how to batch remux those files? the mkvs and the srt files already have the same names, I just need to combine them all at once now.

    Thank you.
    Quote Quote  
  2. Put this (change the path to mkvmerge.exe) in a batch file and put the file in the folder with all you MKV and SRT files. The double click on it. All the new files with the subs muxed in will be in a subfolder called New.

    Code:
    md New
    for %%F in (*.mkv) do ("G:/Program Files/mkvtoolnix\mkvmerge.exe" --output "New\%%~nF.mkv" "%%~dpnxF" "%%~dpnF.srt" )
    pause
    Quote Quote  
  3. It works perfectly! Thank you!!
    Quote Quote  
  4. Hi.
    I'd like to slightly change this command line so that the new subtitles are the first subs track in the file (when the file has other tracks), how can I do that?
    Last edited by Nico Darko; 17th Mar 2021 at 11:42.
    Quote Quote  
  5. Originally Posted by Nico Darko View Post
    Hi.
    I'd like to slightly change this command line so that the new subtitles are the first subs track in the file (when the file has other tracks), how can I do that?
    This will copy all video and audio tracks from the original mp4, then the new srt (converted to timed text), then the subtitles from the original mp4:

    Code:
     
    for %%f in (*.mp4) do ( ffmpeg -i "%%~f" -i "%%~dpnf.srt" -c:v copy -c:a copy -c:s mov_text -map 0:v -map 0:a -map 1:s -map 0:s "%%~dpnf+srt%%~xf" )
    Quote Quote  
  6. It's for a mkv, so I've changed the extension, but it doesn't work, it says:

    subtitle codec 94213 is not supported. could not write headerfor output file #0 (incorrect codec parameter ?) : function not implemented.

    The command line you gave me last time (for mkvtoolnix) does work though.
    Quote Quote  
  7. Originally Posted by Nico Darko View Post
    It's for a mkv, so I've changed the extension, but it doesn't work
    "-c:s mov_text" isn't supported by MKV. You need to specify "-c:s srt" or "-c:s ass" instead.
    Quote Quote  
  8. App Digger JKyle's Avatar
    Join Date
    Oct 2018
    Location
    United States
    Search PM
    Try this one in CMD:

    Code:
    for %f in (*.mkv) do (ffmpeg -hide_banner -i "%f" -i "%~dpnf.srt" -map 0 -map 1 -c copy -c:s srt "%~dpnf+srt%~xf")
    Last edited by JKyle; 18th Mar 2021 at 09:43.
    Quote Quote  
  9. @JKyle: that one didn't work either.

    @jagobo: I made the change, the new file was completed but the new subtitle track is completely empty, the track was added but with no text.
    Quote Quote  
  10. Originally Posted by Nico Darko View Post
    @jagobo: I made the change, the new file was completed but the new subtitle track is completely empty, the track was added but with no text.
    Maybe something wrong with the srt file? Upload it. And post the full text of your ffmpeg command line.
    Quote Quote  
  11. That's the command line:

    Code:
    for %%f in (*.mkv) do ( ffmpeg -i "%%~f" -i "%%~dpnf.srt" -c:v copy -c:a copy -c:s srt -map 0:v -map 0:a -map 1:s -map 0:s "%%~dpnf+srt%%~xf" )
    pause
    I tried a different mkv + srt file and it worked for that one!

    So I don't know if something's wrong with the srt file but it works fine when I use this previous command line (the sub track is just not number 1):

    md New
    for %%F in (*.mkv) do ("G:/Program Files/mkvtoolnix\mkvmerge.exe" --output "New\%%~nF.mkv" "%%~dpnxF" "%%~dpnF.srt" )
    Can't we modify that one instead?
    Quote Quote  
  12. I don't know mkvmerge very well. I found you can add "--track-order 1:0" to the end of the command line and the new sub will appear first in MediaInfo. But if another sub track is marked as "default" in the original video that track will play by default.
    Quote Quote  
  13. Perfect, that's what I needed, the default thing is not a problem. Thank you!
    Quote Quote  



Similar Threads

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