@ECHO off :: PURPOSE :: Joins and converts all AVI files in the current folder into a single MPG and FLV. :: Files are joined in alphabetical order (the same order that Windows explorer sorts them - ascending). :: USAGE :: (1) Put all AVI files you want joined in a single directory. Files must end in ".avi". :: (2) Rename the AVI files so they sort in the order you want them joined. :: (3) Run this script in the directory that contains the files to be converted. :: (4) You now have 2 output files: all.mpg, all.flv :: DEPENDENCIES :: ffmpeg must be installed on the target system. :: The system path must be set to allow access to ffmpeg.exe from the working folder. :: AUTHOR :: Russ Tanner (russ@herballure.com) :: Please send bug reports to the author. :: Donations are appreciated. Send to PayPal account russ@herballure.com :: LICENSING :: This experimental, educational software is offered free and without warranty of any kind. :: By using it, you hold the author harmless of any and all liability. :: Read scientific information about medicinal uses of herbs at OnlyTheBestHerbs.com :: Main ECHO Converting all AVI files to MPG... CALL :ConvertAVIToMPGAll ECHO Joining MPG Files... CALL :JoinAllMPG :: We just joined all MPGs to all.mp_. :: We now need to rename it to all.mpg. rename all.mp_ all.mpg ECHO Making final FLV file... CALL :MakeFLV ECHO Complete! GOTO :eof :: Functions :ConvertAVIToMPGAll :: PURPOSE: This converts all AVIs in the current directory to MPGs. :: They are converted in the order they sort in - ascending. FOR /f %%a IN ('dir /b *.avi') DO CALL :ConvertAVIToMPG "%%a" GOTO :eof :ConvertAVIToMPG :: PURPOSE: Converts the specified file to an MPG. ECHO %~1 ::ffmpeg -i %1 -v 0 -f vcd -vcodec mpeg1video -b 1150 -r 29.97 -g 12 -qmin 3 -qmax 13 -acodec mp2 -sameq -ab 224 -ar 44100 -ac 2 -y %~n1.mpg 2>NUL ffmpeg -i %1 -v 0 -f vcd -vcodec mpeg1video -b 1150 -acodec mp2 -sameq -ab 224 -ar 44100 -ac 2 -y %~n1.mpg 2>NUL GOTO :eof :JoinAllMPG CALL :CreateEmptyMPG FOR /f %%a IN ('dir /b *.mpg') DO CALL :AppendFileToMPG "%%a" GOTO :eof :AppendFileToMPG :: PURPOSE: Used to append the specified file to the file "all.mp_". ECHO %~1 copy /b all.mp_+%1 tmp.mpg 1>NUL del all.mp_ rename tmp.mpg all.mp_ GOTO :eof :CreateEmptyMPG :: PURPOSE: Creates an empty file for use as a starting point for the compiled MPG ("all.mp_"). type nul >all.mp_ GOTO :eof :MakeFLV :: PURPOSE: Converts the file all.mpg to all.flv ffmpeg -i all.mpg -v 0 -s qvga -ac 1 -ar 22050 -sameq -y all.flv 2>NUL GOTO :eof :eof