Page 1 of 1

Mux video and subtitle files with a batch file

Posted: 15 Feb 2017 19:52
by joetex72
I have some files split in to parts

Code: Select all

G:\Video\Merge>dir
 Volume in drive G is Local Disk
 Volume Serial Number is 0000-0000

 Directory of G:\Video\Merge

02/15/2017  07:07 PM    <DIR>          .
02/15/2017  07:07 PM    <DIR>          ..
02/02/2017  11:09 AM             2,457 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 1.en.srt
02/02/2017  11:10 AM        23,558,827 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 1.mp4
02/02/2017  11:10 AM            35,725 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 2.en.srt
02/02/2017  11:16 AM       240,639,914 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 2.mp4
02/02/2017  11:16 AM            22,198 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 3.en.srt
02/02/2017  11:20 AM       174,219,937 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 3.mp4
02/02/2017  11:20 AM            24,890 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 4.en.srt
02/02/2017  11:24 AM       176,740,800 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 4.mp4
02/02/2017  11:24 AM            15,383 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 5.en.srt
02/02/2017  11:27 AM       120,189,574 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 5.mp4
02/02/2017  11:27 AM            13,777 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 6.en.srt
02/02/2017  11:29 AM       106,429,895 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 6.mp4
02/02/2017  11:29 AM            29,113 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 7.en.srt
02/02/2017  11:34 AM       180,698,440 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 7.mp4
02/02/2017  11:34 AM             5,349 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 8.en.srt
02/02/2017  11:35 AM        44,199,794 mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 8.mp4
02/02/2017  11:35 AM             1,457 mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 9.en.srt
02/02/2017  11:35 AM         8,674,921 mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 9.mp4
02/02/2017  11:35 AM             1,680 mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 10.en.srt
02/02/2017  11:35 AM        13,308,582 mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 10.mp4
02/13/2017  01:23 AM               157 temp.bat
              21 File(s)  1,088,812,870 bytes
               2 Dir(s)  78,662,598,656 bytes free

G:\Video\Merge>

that I'd like to combine into one mkv file with ffmpeg. The parts would have to be muxed to multiple mkv files first then concatenated to a single file. Since the series name is common in all the parts, I'm looking for a command like

Code: Select all

for %%i in (*Are You The One*) do (
ffmpeg -i "*Are You The One*.mp4" -i "*Are You The One*.en.srt" -c copy "temp##.mkv")

that looks for all files with that filename and muxes each part and outputs temporary files like

Code: Select all

ffmpeg -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 1.mp4" -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 1.en.srt" -c copy "temp01.mkv"
ffmpeg -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 2.mp4" -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 2.en.srt" -c copy "temp02.mkv"
ffmpeg -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 3.mp4" -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 3.en.srt" -c copy "temp03.mkv"
...
ffmpeg -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 8.mp4" -i "mtv-1416884400 Are You The One_November 24, 2014_2_208_Dumped_Act 8.en.srt" -c copy "temp08.mkv"
ffmpeg -i "mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 9.mp4" -i "mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 9.en.srt" -c copy "temp09.mkv"
ffmpeg -i "mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 10.mp4" -i "mtv-1417052100 Are You The One_November 24, 2014_2_208_Dumped_Act 10.en.srt" -c copy "temp10.mkv"

then I would concatenate (join/merge) the temp files to a single file with another loop (this part is easy). Some series have more than 10 parts, some have less.
---

Code: Select all

 INFO.BAT version 1.4
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 10.0.14393]
Product name           :  Windows 10 Pro, 64 bit
Performance indicators :  Processor Cores: 8      Visible RAM: 16656752 kilobytes

Date/Time format       :  (mm/dd/yy)  Wed 02/15/2017   6:26:04.44
__APPDIR__             :  C:\WINDOWS\system32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
Extensions             :  system: Enabled   user: Enabled
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-US       Code Pages: OEM  437    ANSI 1252
DIR  format            :  02/06/2017  06:12 AM     5,889,851,392 pagefile.sys
Permissions            :  Elevated Admin=No, Admin group=Yes

                          Missing from the tool collection:  debug

So in short, not help with ffmpeg, I'm looking for a command that grabs Act 1.mp4 and Act 1.en.srt and outputs TEMP01.mkv up to Act 10.mp4 and Act 10.en.srt and outputs TEMP10.mkv or however many parts there are.

Re: Mux video and subtitle files with a batch file

Posted: 16 Feb 2017 23:08
by Squashman
See my answer over on TechGuy.
https://forums.techguy.org/threads/batc ... s.1185352/

Your file name examples over here are a bit different but if you understand the code I provided you should easily be able to adapt it.

Re: Mux video and subtitle files with a batch file

Posted: 17 Feb 2017 01:07
by joetex72
Yeah, that did it. Thanks again, you always come through for me.