Page 1 of 1
Combine Sequential MP4 Files After Download
Posted: Wed Dec 02, 2015 2:13 pm
by SkydiverFL
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.
Re: Combine Sequential MP4 Files After Download
Posted: Wed Dec 02, 2015 7:51 pm
by therube
I have a "CONCAT.BAT":
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
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.
Re: Combine Sequential MP4 Files After Download
Posted: Wed Dec 09, 2015 3:23 am
by therube
And the missing sed's:
sed_go1:
Code: Select all
s/\"/'/g
s/^\s*//
s/\s*$//
s/^\s*'//
s/'\s*$//
s/' '/\n/g
s/' /'\n/g
/^\s*$/d
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.]