Combine Sequential MP4 Files After Download
- 
				SkydiverFL
 - Posts: 1
 - Joined: Wed Dec 02, 2015 2:08 pm
 
Combine Sequential MP4 Files After Download
How can I combine hundreds of sequentially named MP4 files after they are downloaded?  The training course I am downloading is divided into "chapters" and "segments".  I need to have one single MP4 file so I may load it into iTunes or Plex.
			
			
									
						
										                        Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36
						Re: Combine Sequential MP4 Files After Download
I have a "CONCAT.BAT":
sed is used to clean up the inputs to get things into an order that ffmpeg will like.
[the actual contents {"commands"} for sed will have to wait till i get access to them]
More generally:
FFmpeg wiki: Concatenate
Zeranoe: Concatenate videos in Windows with a batch file.
			
			
									
						
							Code: Select all
@ECHO OFF
ECHO  CONCATenate all the parts of a multiple movie into one
ECHO  "specs" should be the same, files listed in the correct order, 1 to X...
ECHO  therube 01/23/2015
ECHO.
ECHO  %*
ECHO.
pause
SET     OUT=C:\OUT
ECHO    OUT=: %OUT%
SET   OFILE=%OUT%\%~n1_CONCAT%~x1
ECHO  Output filename: "%OFILE%"
ECHO. > %OUT%\CONCAT1.TXT
PAUSE
echo FOR: 
PAUSE
for %%i in (%*) do echo %%~i >> %OUT%\CONCAT1.TXT
cat         %OUT%\CONCAT1.TXT
PAUSE
sed -f %OUT%\sed_go1 < %OUT%\CONCAT1.TXT > %OUT%\CONCAT2.TXT
cat         %OUT%\CONCAT2.TXT
PAUSE
sed -f %OUT%\sed_go2 < %OUT%\CONCAT2.TXT > %OUT%\CONCAT3.TXT
cat         %OUT%\CONCAT3.TXT
PAUSE
ffmpeg -f concat -i %OUT%\CONCAT3.TXT -c copy "%OFILE%"
PAUSE
EXIT
[the actual contents {"commands"} for sed will have to wait till i get access to them]
More generally:
FFmpeg wiki: Concatenate
Zeranoe: Concatenate videos in Windows with a batch file.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
			                        Mozilla/5.0 (Windows NT 5.1; rv:42.0) Gecko/20100101 SeaMonkey/2.39
						Re: Combine Sequential MP4 Files After Download
And the missing sed's:
sed_go1:
sed_go2
(All they do is to format the list of file names in a manner that FFmpeg will like.)
[I would typically select the source files using either Everything or my file manager, Salamander, & "Send to... -> CONCAT" from there.]
			
			
									
						
							sed_go1:
Code: Select all
s/\"/'/g
s/^\s*//
s/\s*$//
s/^\s*'//
s/'\s*$//
s/' '/\n/g
s/' /'\n/g
/^\s*$/d
Code: Select all
s/^/file '/
s/$/'/
(All they do is to format the list of file names in a manner that FFmpeg will like.)
[I would typically select the source files using either Everything or my file manager, Salamander, & "Send to... -> CONCAT" from there.]
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
			                        Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39