@ECHO OFF
ECHO ---[###] Start of batch file
REM ECHO --[###] COMMAND-LINE-USAGE: encodemovie MOVIENUMBER FPS OUTPUT_AVI
REM ECHO --[###] Example: encodemovie 001 17 pie_is_good.avi

set a=%1
IF NOT "%1" == "" GOTO PROCEED1
SET /p a=--[@] What moviedeck to process? (example: 001): 

:PROCEED1
set b=%2
IF NOT "%2" == "" GOTO PROCEED2
SET /p b=--[@] What should the frames per second rate for the resulting video be? (example: 17): 

set c=%3
:PROCEED2
IF NOT "%3" == "" GOTO PROCEED3
SET /p c=--[@] What should the resulting filename be? (example: pie_is_good.avi): 


:PROCEED3
IF NOT EXIST MOVIES GOTO Err_nomovies
cd MOVIES
IF NOT EXIST "%a%" GOTO Err_nomdir
cd %a%
..\..\mencoder mf://*.bmp -mf w=320:h=200:fps=%b%:type=bmp -ovc lavc -lavcopts vcodec=mpeg4 -vf harddup -o %c%
IF NOT EXIST "%c%" GOTO Err_failmcoder
move %c% ..\..\
cd ..
cd ..
goto end


:Err_nomovies
ECHO --[###] BATCH FILE ERROR: no MOVIES folder exists.
GOTO end

:Err_nomdir
ECHO --[###] BATCH FILE ERROR: no %a% folder exists inside 'MOVIES'.
cd ..
GOTO end

:Err_failmcoder
ECHO --[###] BATCH FILE ERROR: MENCODER: File %c% does not exist. MEncoder failed.
cd ..
cd ..
GOTO end

:Err1
:Err2
:Err3
ECHO --[###] BATCH FILE INPUT ERROR: Invalid argument(s).
ECHO --[###] USAGE: encodemovie MOVIENUMBER FPS OUTPUT_AVI
ECHO --[###] Example: encodemovie 001 17 pie_is_good.avi
GOTO end


:end
ECHO ---[###] End of batch file
pause