Difference between revisions of "Anri-chan/Source/anri.bat"

From SDA Knowledge Base

Jump to: navigation, search
(the shortcuts install.bat makes already handle starting on the desktop so now settings.bat just needs to set curdir= whatever the user's preferred working dir is and we're "set" (harhar))
(reverted to rc1 due to unsolvable audio desync problem with indexing all chapters at once)
Line 1: Line 1:
 
<pre><nowiki>@ECHO OFF
 
<pre><nowiki>@ECHO OFF
  
REM metroid 2002 speed demos archive anri-chan 1
+
REM metroid 2002 speed demos archive anri-chan rc1
 
REM http://www.metroid2002.com/
 
REM http://www.metroid2002.com/
 
REM http://speeddemosarchive.com/
 
REM http://speeddemosarchive.com/
Line 8: Line 8:
 
REM Philip "ballofsnow" Cornell
 
REM Philip "ballofsnow" Cornell
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
 
 
REM INITIALISATION
 
REM INITIALISATION
 
(SET in_anrichan=y)
 
(SET in_anrichan=y)
 
(SET anri_dir=%~dp0)
 
(SET anri_dir=%~dp0)
 
(SET anri_path=%~dp0anri.bat)
 
(SET anri_path=%~dp0anri.bat)
(SET curdir=%CD%)
+
(SET curdir=%HOMEPATH%\Desktop)
 
CALL "%anri_dir%settings.bat"
 
CALL "%anri_dir%settings.bat"
  
 
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM SETTINGS
 
REM SETTINGS
(SET vars_to_use=temp_files this_anriver done d f vhs onepixel nes twod statid statid1 statid2 statid3 driveletter projname gba gameboy odd dvdsource prog trim trim1 trim2 create_hq create_mq create_lq create_iq create_xm create_xl using_settings check_now avipath deflicker twodtemp maxaudiobitrate)
+
(SET vars_to_use=temp_files this_anriver done d f vhs onepixel nes twod statid statid1 statid2 statid3 driveletter chapternumber projname gba gameboy odd dvdsource vbo prog trim trim1 trim2 create_hq create_mq create_lq create_iq create_xm create_xl using_settings check_now avipath deflicker twodtemp)
(SET anri_ver=1)
+
(SET anri_ver=rc1)
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM MAIN PROCEDURE
 
REM MAIN PROCEDURE
 
:proc_main
 
:proc_main
Line 41: Line 38:
 
IF "%dvdsource%"=="y" (
 
IF "%dvdsource%"=="y" (
 
   CALL :q_driveletter
 
   CALL :q_driveletter
 +
  CALL :q_vbo
 +
  IF NOT "%vbo%"=="y" CALL :q_chapternumber
 
   CALL :index_dvd
 
   CALL :index_dvd
 
   IF EXIST *.wav GOTO doneindexing
 
   IF EXIST *.wav GOTO doneindexing
Line 108: Line 107:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
 
 
REM QUESTIONS ABOUT MOVIE SOURCE
 
REM QUESTIONS ABOUT MOVIE SOURCE
  
Line 130: Line 129:
 
SET /P s=DVD Drive Letter:  
 
SET /P s=DVD Drive Letter:  
 
CALL :set_var_letter driveletter q_driveletter
 
CALL :set_var_letter driveletter q_driveletter
IF EXIST %driveletter%:\VIDEO_TS (
+
GOTO :EOF
  SET dvdfolder=VIDEO_TS
+
 
) ELSE (
+
:q_vbo
  IF EXIST %driveletter%:\DVD_RTAV (
+
SET s=
    SET dvdfolder=DVD_RTAV
+
SET /P s=DVD-RAM .VRO source? Answer n if you don't know [y,n]:
  ) ELSE (
+
CALL :set_var_bool vbo q_vbo
    ECHO Neither VIDEO_TS or DVD_RTAV folder was found on %driveletter%:\. Anri-chan is displeased.
+
GOTO :EOF
    goto :die
+
 
    exit
+
:q_chapternumber
  )
+
SET s=
)
+
SET /P s=DVD Chapter Number:
 +
CALL :set_var_number chapternumber q_chapternumber 9
 
GOTO :EOF
 
GOTO :EOF
  
Line 292: Line 292:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM DFND SECTION
 
REM DFND SECTION
  
Line 339: Line 338:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM SUBROUTINES TO VALIDATE/SET VARIABLES
 
REM SUBROUTINES TO VALIDATE/SET VARIABLES
  
Line 410: Line 408:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM FILE HANDLING
 
REM FILE HANDLING
  
Line 434: Line 431:
 
CALL :out_info anri-chan will now open DGMPGDec to index your DVD movie files. Once it is finished, anri-chan will continue.
 
CALL :out_info anri-chan will now open DGMPGDec to index your DVD movie files. Once it is finished, anri-chan will continue.
 
PAUSE
 
PAUSE
IF EXIST FILELIST.TXT del FILELIST.TXT
+
IF "%vbo%"=="y" (
FOR %%I IN (%driveletter%:\%dvdfolder%\*.V*) DO ECHO %%I >> FILELIST.TXT
+
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\DVD_RTAV\VR_MOVIE.VRO] -OM=3 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template.avs] -exit
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -BF=[FILELIST.TXT] -OM=3 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template.avs] -exit
+
) ELSE (
COPY /Y "%projname%.avs" "%projname%.bak"
+
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\VIDEO_TS\VTS_0%chapternumber%_1.VOB] -OM=3 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template.avs] -exit
FOR /f "tokens=4 delims= " %%a IN ('dir /b *.wav') DO SET maxaudiobitrate=%%a
+
)
(SET maxaudiobitrate=%maxaudiobitrate:~0,3%000)
+
MOVE /Y "%projname%.avs" "%projname%.bak"
 
GOTO :EOF
 
GOTO :EOF
  
 
:index_dvd_mpa
 
:index_dvd_mpa
IF EXIST FILELIST.TXT del FILELIST.TXT
+
IF "%vbo%"=="y" (
for %%I in (%driveletter%:\%dvdfolder%\*.V*) do echo %%I >> FILELIST.TXT
+
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\DVD_RTAV\VR_MOVIE.VRO] -OM=2 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template_mpa.avs] -exit
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -BF=[FILELIST.TXT] -OM=2 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template_mpa.avs] -exit
+
) ELSE (
COPY /Y "%projname%.avs" "%projname%.bak"
+
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\VIDEO_TS\VTS_0%chapternumber%_1.VOB] -OM=2 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template_mpa.avs] -exit
SET maxaudiobitrate=320000
+
)
 +
MOVE /Y "%projname%.avs" "%projname%.bak"
 
GOTO :EOF
 
GOTO :EOF
  
Line 470: Line 468:
 
IF "%odd%"=="y" (
 
IF "%odd%"=="y" (
 
TYPE "%PROGRAMFILES%\anrichan\deint_odd.txt" >> "%projname%_temp_2.avs"
 
TYPE "%PROGRAMFILES%\anrichan\deint_odd.txt" >> "%projname%_temp_2.avs"
) ELSE (
+
) ELSE TYPE "%PROGRAMFILES%\anrichan\deint.txt" >> "%projname%_temp_2.avs"
  IF "%dvdsource%"=="y" TYPE "%PROGRAMFILES%\anrichan\deint.txt" >> "%projname%_temp_2.avs"
+
)
+
 
+
 
IF "%onepixel%"=="y" ECHO nate_1_pixel_bob_fix >> "%projname%_temp_2.avs"
 
IF "%onepixel%"=="y" ECHO nate_1_pixel_bob_fix >> "%projname%_temp_2.avs"
 
IF "%gba%"=="y" ECHO nate_retard_bob_2 >> "%projname%_temp_2.avs"
 
IF "%gba%"=="y" ECHO nate_retard_bob_2 >> "%projname%_temp_2.avs"
Line 539: Line 534:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM SETTINGS MANAGER
 
REM SETTINGS MANAGER
  
Line 559: Line 553:
 
IF "%dvdsource%"=="y" (
 
IF "%dvdsource%"=="y" (
 
CALL :out_info DVD Drive Letter: %driveletter%
 
CALL :out_info DVD Drive Letter: %driveletter%
 +
IF "%vbo%"=="y" (
 +
CALL :out_info DVD-RAM .VRO Source: Yes
 +
) ELSE (
 +
CALL :out_info DVD-RAM .VRO Source: No
 +
)
 +
IF NOT "%chapternumber%"=="" CALL :out_info DVD Chapter Number: %chapternumber%
 
)
 
)
 
CALL :out_info Project Name: %projname%
 
CALL :out_info Project Name: %projname%
Line 610: Line 610:
 
ECHO ^(SET statid3=%statid3%^) >> "%projname%_job.bat"
 
ECHO ^(SET statid3=%statid3%^) >> "%projname%_job.bat"
 
ECHO ^(SET driveletter=%driveletter%^) >> "%projname%_job.bat"
 
ECHO ^(SET driveletter=%driveletter%^) >> "%projname%_job.bat"
 +
ECHO ^(SET chapternumber=%chapternumber%^) >> "%projname%_job.bat"
 
ECHO ^(SET projname=%projname%^) >> "%projname%_job.bat"
 
ECHO ^(SET projname=%projname%^) >> "%projname%_job.bat"
 
ECHO ^(SET gba=%gba%^) >> "%projname%_job.bat"
 
ECHO ^(SET gba=%gba%^) >> "%projname%_job.bat"
Line 615: Line 616:
 
ECHO ^(SET odd=%odd%^) >> "%projname%_job.bat"
 
ECHO ^(SET odd=%odd%^) >> "%projname%_job.bat"
 
ECHO ^(SET dvdsource=%dvdsource%^) >> "%projname%_job.bat"
 
ECHO ^(SET dvdsource=%dvdsource%^) >> "%projname%_job.bat"
 +
ECHO ^(SET vbo=%vbo%^) >> "%projname%_job.bat"
 
ECHO ^(SET prog=%prog%^) >> "%projname%_job.bat"
 
ECHO ^(SET prog=%prog%^) >> "%projname%_job.bat"
 
ECHO ^(SET trim=%trim%^) >> "%projname%_job.bat"
 
ECHO ^(SET trim=%trim%^) >> "%projname%_job.bat"
 
ECHO ^(SET trim1=%trim1%^) >> "%projname%_job.bat"
 
ECHO ^(SET trim1=%trim1%^) >> "%projname%_job.bat"
 
ECHO ^(SET trim2=%trim2%^) >> "%projname%_job.bat"
 
ECHO ^(SET trim2=%trim2%^) >> "%projname%_job.bat"
ECHO ^(SET maxaudiobitrate=%maxaudiobitrate%^) >> "%projname%_job.bat"
+
ECHO IF NOT "%%in_anrichan%%"=="y" CALL "%anri_path%" >> "%projname%_job.bat"
ECHO IF NOT "%%in_anrichan%%"=="y" call "%anri_path%" >> "%projname%_job.bat"
+
 
GOTO :EOF
 
GOTO :EOF
  
Line 629: Line 630:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM QUALITIES SELECTION
 
REM QUALITIES SELECTION
  
Line 662: Line 662:
 
GOTO :EOF
 
GOTO :EOF
  
 
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM ENCODING
 
REM ENCODING
  
Line 684: Line 682:
 
IF "%create_iq%"=="y" (
 
IF "%create_iq%"=="y" (
 
CALL :out_section encoding %projname% IQ MP4
 
CALL :out_section encoding %projname% IQ MP4
CALL :2pass %projname%_IQ.avs %projname%_IQ      5000 %maxaudiobitrate% 19 1 1
+
CALL :2pass %projname%_IQ.avs %projname%_IQ      5000 320000 19 1 1
 
)
 
)
  
Line 701: Line 699:
  
 
:2pass
 
:2pass
"%PROGRAMFILES%\anrichan\x264.exe" --pass 1 --bitrate %3 --stats "%2.stats" --bframes 16 --analyse none --qpmin %5 --threads auto --thread-input --progress --no-psnr --no-ssim --output NUL %1
+
"%PROGRAMFILES%\anrichan\x264.exe" --pass 1 --bitrate %3 --stats "%2.stats" --bframes 16 --analyse none --qpmin %5 --threads auto --thread-input --progress --no-psnr --no-ssim --output NUL "%1"
"%PROGRAMFILES%\anrichan\x264.exe" --pass 2 --bitrate %3 --stats "%2.stats" --direct auto --ref 8 --mixed-refs --no-fast-pskip --bframes 16 --b-rdo --bime --weightb --subme 7 --trellis 2 --analyse all --qpmin %5 --me umh --threads auto --thread-input --progress --no-psnr --output "%2_video.mp4" %1
+
"%PROGRAMFILES%\anrichan\x264.exe" --pass 2 --bitrate %3 --stats "%2.stats" --direct auto --ref 8 --mixed-refs --no-fast-pskip --bframes 16 --b-rdo --bime --weightb --subme 7 --trellis 2 --analyse all --qpmin %5 --me umh --threads auto --thread-input --progress --no-psnr --output "%2_video.mp4" "%1"
"%PROGRAMFILES%\anrichan\virtualdub-1.7.1\vdub.exe" %1 /i "%PROGRAMFILES%\anrichan\audioout.vcf" "%2_temp.wav"
+
"%PROGRAMFILES%\anrichan\virtualdub-1.7.1\vdub.exe" "%1" /i "%PROGRAMFILES%\anrichan\audioout.vcf" "%2_temp.wav"
 
"%PROGRAMFILES%\anrichan\neroAacEnc.exe" -br %4 -lc -if "%2_temp.wav" -of "%2_audio.mp4"
 
"%PROGRAMFILES%\anrichan\neroAacEnc.exe" -br %4 -lc -if "%2_temp.wav" -of "%2_audio.mp4"
 
"%PROGRAMFILES%\anrichan\MP4Box.exe" -tmp . -new -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4"
 
"%PROGRAMFILES%\anrichan\MP4Box.exe" -tmp . -new -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4"
Line 711: Line 709:
  
 
:xvid
 
:xvid
"%PROGRAMFILES%\anrichan\xvid_encraw.exe" -i %1 -bitrate %3 -pass1 "%2.stats"
+
"%PROGRAMFILES%\anrichan\xvid_encraw.exe" -i "%1" -bitrate %3 -pass1 "%2.stats"
"%PROGRAMFILES%\anrichan\xvid_encraw.exe" -i %1 -bitrate %3 -pass2 "%2.stats" -avi "%2v.avi"
+
"%PROGRAMFILES%\anrichan\xvid_encraw.exe" -i "%1" -bitrate %3 -pass2 "%2.stats" -avi "%2v.avi"
"%PROGRAMFILES%\anrichan\ffmpeg.exe" -b %4 -ac 2 -acodec mp3 -y -i "%2v.avi" -vcodec copy -i %1 "%2.avi"
+
"%PROGRAMFILES%\anrichan\ffmpeg.exe" -b %4 -ac 2 -acodec mp3 -y -i "%2v.avi" -vcodec copy -i "%1" "%2.avi"
 
IF "%5" == "1" del "%2.stats"
 
IF "%5" == "1" del "%2.stats"
 
IF "%6" == "1" del "%2v.avi"
 
IF "%6" == "1" del "%2v.avi"
Line 719: Line 717:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM OUTPUT
 
REM OUTPUT
  
Line 763: Line 760:
  
  
REM # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 
REM OTHER
 
REM OTHER
  

Revision as of 20:13, 26 July 2007

@ECHO OFF

REM metroid 2002 speed demos archive anri-chan rc1
REM http://www.metroid2002.com/
REM http://speeddemosarchive.com/
REM nathan jahnke <njahnke@gmail.com>
REM Ian Bennett
REM Philip "ballofsnow" Cornell


REM INITIALISATION
(SET in_anrichan=y)
(SET anri_dir=%~dp0)
(SET anri_path=%~dp0anri.bat)
(SET curdir=%HOMEPATH%\Desktop)
CALL "%anri_dir%settings.bat"

REM SETTINGS
(SET vars_to_use=temp_files this_anriver done d f vhs onepixel nes twod statid statid1 statid2 statid3 driveletter chapternumber projname gba gameboy odd dvdsource vbo prog trim trim1 trim2 create_hq create_mq create_lq create_iq create_xm create_xl using_settings check_now avipath deflicker twodtemp)
(SET anri_ver=rc1)


REM MAIN PROCEDURE
:proc_main
CALL :out_cls
IF "%main_anri_updated%"=="y" GOTO die
IF "%using_settings%"=="y" GOTO proc_check_settings
CALL :resetvars
CALL :out_cls
CALL :out_info ON HERMESUS LUC ARSUS ESTARIAS AUC ELTRAS LI CELES! Now, let's get to work!
CALL :out_section PROJECT SETUP
CALL :q_projname
CALL :make_projdir
CALL :find_existing_settings
IF "%using_settings%"=="y" GOTO proc_check_settings
CALL :out_cls_section MOVIE SOURCE
CALL :q_dvdsource
IF "%dvdsource%"=="y" (
  CALL :q_driveletter
  CALL :q_vbo
  IF NOT "%vbo%"=="y" CALL :q_chapternumber
  CALL :index_dvd
  IF EXIST *.wav GOTO doneindexing
  CALL :wipe_projdir
  CALL :make_projdir
  CALL :index_dvd_mpa
) ELSE CALL :q_avipath
:doneindexing
CALL :out_cls_section GAME PROPERTIES
CALL :q_dfnd
IF NOT "%d%"=="1" IF NOT "%d%"=="4" CALL :q_d
IF NOT "%f%"=="1" IF NOT "%f%"=="2" IF NOT "%f%"=="3" CALL :q_f
IF NOT "%f%"=="1" SET twod=n
IF NOT "%twod%"=="y" IF NOT "%twod%"=="n" CALL :q_2d
IF NOT "%dfnd_set%"=="y" CALL :q_submit_dfnd

CALL :out_cls_section VIDEO PROPERTIES
CALL :q_prog
IF "%prog%"=="y" GOTO contprop
CALL :q_vhs
IF "%d%"=="1" GOTO contprop
CALL :q_odd
CALL :q_onepixel
CALL :q_nes
IF "%nes%"=="y" GOTO contprop
CALL :q_gba
IF "%gba%"=="y" GOTO contprop
CALL :q_gameboy
IF "%gameboy%"=="y" GOTO contprop
CALL :q_deflicker

:contprop
CALL :out_cls_section CONTENT PROPERTIES
CALL :q_trim
IF "%trim%"=="y" CALL :q_trim_1
IF "%trim%"=="y" CALL :q_trimtwo
CALL :q_statid
IF "%statid%"=="y" CALL :q_statid_lines

:proc_check_settings
CALL :check_settings
IF "%settings_good%"=="y" (
  CALL :savesettings
  CALL :out_cls_section READY TO ENCODE
  CALL :out_info Your settings for this project have been saved to "%projname%_job.bat". To resume the project, double-click that file.
  CALL :q_encodenow
  GOTO :start_encode_test
) ELSE (
  CALL :wipe_projdir
  CALL :resetvars
  SET using_settings=
  GOTO proc_main
)

:proc_encode
CALL :script_buildfiles
CALL :out_cls_section ENCODING OPTIONS
CALL :select_qualities
REM IF "%not_encoding%"=="y" GOTO proc_close
REM see below comment for more about this
REM CALL :out_cls_info Now encoding.
CALL :encode_movies

:proc_close
ECHO All dun.
GOTO die



REM QUESTIONS ABOUT MOVIE SOURCE

:q_dfnd
CALL :out_info The next few questions are about the game played in this video. SDA has a database of games we have seen in the past, which can answer some or all of the questions for you.
SET s=
SET /P s=Do you want to use Anri-chan's games database [Y] or enter the data yourself [N]? [y,n] 
CALL :set_var_bool dfnd q_dfnd
IF "%dfnd%"=="y" CALL :dfnd
GOTO :EOF

:q_dvdsource
CALL :out_info Tip: If you already have your DVD source files on your hard drive, move them into C:\VIDEO_TS\, select Yes here and select C as your drive letter.
SET s=
SET /P s=DVD source [y,n]: 
CALL :set_var_bool dvdsource q_dvdsource
GOTO :EOF

:q_driveletter
SET s=
SET /P s=DVD Drive Letter: 
CALL :set_var_letter driveletter q_driveletter
GOTO :EOF

:q_vbo
SET s=
SET /P s=DVD-RAM .VRO source? Answer n if you don't know [y,n]: 
CALL :set_var_bool vbo q_vbo
GOTO :EOF

:q_chapternumber
SET s=
SET /P s=DVD Chapter Number: 
CALL :set_var_number chapternumber q_chapternumber 9
GOTO :EOF

:q_projname
SET s=
SET /P s=Project name (no spaces allowed; if you enter the same name as an existing project then all of its files will be overwritten): 
CALL :set_var_nospace projname q_projname
GOTO :EOF

:q_avipath
SET s=
SET /P s=Path to source video file e.g. c:\path to\video.avi without quotes: 
CALL :set_var_notnull avipath q_avipath
GOTO :EOF

:q_d
CALL :out_info "D" and "F" are letters used at SDA to refer to the video dimensions and framerate. D1 is full resolution and D4 is half resolution. F1 is full framerate, F2 is half framerate and F3 is 1/3 framerate.
CALL :out_info Find D and F for your game at this URL:
CALL :out_info http://speeddemosarchive.com/kb/index.php/DF
CALL :out_info If you don't see your game listed there, you can use the Extract Sample utility to make a sample video to post in the SDA Tech Support Forum. Someone there will look at the video and let you know what D and F are.
:q_d_p2
SET s=
SET /P s=D [1,4]: 
CALL :set_var_in d q_d_p2 14
GOTO :EOF

:q_prog
SET s=
SET /P s=Progressive scan source? Answer n if you don't know [y,n]: 
CALL :set_var_bool prog q_prog
GOTO :EOF

:q_vhs
SET s=
SET /P s=Originally VHS [y,n]: 
CALL :set_var_bool vhs q_vhs
GOTO :EOF

:q_odd
SET s=
SET /P s=Odd dominant ... answer n if you don't know [y,n]: 
CALL :set_var_bool odd q_odd
GOTO :EOF

:q_onepixel
SET s=
SET /P s=1 pixel bob ... answer y if it's jumping up and down [y,n]: 
CALL :set_var_bool onepixel q_onepixel
GOTO :EOF

:q_nes
SET s=
SET /P s=NES [y,n]: 
CALL :set_var_bool nes q_nes
GOTO :EOF

:q_gba
SET s=
SET /P s=Game Boy Advance [y,n]: 
CALL :set_var_bool gba q_gba
GOTO :EOF

:q_gameboy
SET s=
SET /P s=Game Boy [y,n]: 
CALL :set_var_bool gameboy q_gameboy
GOTO :EOF

:q_deflicker
SET s=
SET /P s=Deflickered (rereleased old game e.g. Mega Man AC, Sonic Mega Collection, Wii Virtual Console) [y,n]: 
CALL :set_var_bool deflicker q_deflicker
GOTO :EOF

:q_f
SET s=
SET /P s=F [1,2,3]: 
CALL :set_var_number f q_f 3
GOTO :EOF

:q_2d
SET s=
SET /P s=2D game [y,n]: 
CALL :set_var_bool twod q_2d
GOTO :EOF

:q_trim
CALL :out_info Trimming lets you remove the start and end of the existing movie so you only keep the run itself.
:q_trim_p2
SET s=
SET /P s=Do you want to trim off unwanted content in this video? [y,n]: 
CALL :set_var_bool trim q_trim_p2
GOTO :EOF

:q_trim_1
CALL :out_info VirtualDub will now open with a low quality temporary version of the source video. Use the slider at the bottom of the VirtualDub window to locate the first and last frame numbers of the part of the video you WANT TO KEEP, then input them here. When you are done, you can close the VirtualDub window.
PAUSE
CALL :sball
START "trimming vdub" "%PROGRAMFILES%\anrichan\virtualdub-1.7.1\virtualdub.exe" "%projname%_trimtemp.avs"

:q_trimone
SET s=
SET /P s=First frame to keep: 
CALL :set_var_number trim1 q_trimone
GOTO :EOF

:q_trimtwo
SET s=
SET /P s=Last frame to keep: 
CALL :set_var_number trim2 q_trimtwo
GOTO :EOF

:q_statid
CALL :out_info Set the info shown on the Station ID (the clip at the start of an SDA movie). Run the Station ID Preview program for a preview.
:q_statid_p2
SET s=
SET /P s=Do you want to append an SDA Station ID to the front and end of this video? [y,n]: 
CALL :set_var_bool statid q_statid_p2
GOTO :EOF

:q_statid_lines
CALL :out_info Line 1 is normally the runner's name. Line 2 (and Line 3 if necessary) normally include the game name, the type of run and the time to completion.
SET /P statid1=Station ID Line 1: 
SET /P statid2=Station ID Line 2: 
SET /P statid3=Station ID Line 3: 
GOTO :EOF

:q_encodenow
SET s=
SET /P s="Do you want to start encoding now [Y] or save the job for a later date [N]? "
CALL :set_var_bool start_encode q_encodenow
GOTO :EOF

:q_update_anri
SET s=
SET /P s="Do you want to update Anri-chan's games database now? [y,n] "
CALL :set_var_bool check_now q_update_anri
GOTO :EOF

:q_submit_dfnd
CALL :out_info You didn't use the anri-chan DFnD database. Does that mean that it didn't have your game?
CALL :out_info If so, we'd love it if you posted the "D", "F" and "2D Game" info you just entered here, into our DFnD updates topic on SDA, so we can add it to the next version of the database. You don't need to register to do so and it only takes a few seconds.
SET s=
SET /P s="Submit this game's DFnD data to SDA? [y,n] "
CALL :set_var_bool submit_dfnd q_submit_dfnd
IF "%submit_dfnd%"=="n" GOTO :EOF
START http://speeddemosarchive.com/yabb/YaBB.pl?board=other;action=post;num=1180412303;title=Post+reply;start=
CALL :out_info Thanks!
PAUSE
GOTO :EOF


REM DFND SECTION

:dfnd
CALL :q_update_anri
IF "%check_now%"=="y" (
DEL dfnd_data_temp.bat
"%anri_dir%wget.exe" http://speeddemosarchive.com/anri-chan/dfnd_data_temp.bat
DEL dfnd_titles_temp.bat
"%anri_dir%wget.exe" http://speeddemosarchive.com/anri-chan/dfnd_titles_temp.bat
IF EXIST "dfnd_data_temp.bat" MOVE /Y "dfnd_data_temp.bat" "%anri_dir%dfnd_data.bat"
IF EXIST "dfnd_titles_temp.bat" MOVE /Y "dfnd_titles_temp.bat" "%anri_dir%dfnd_titles.bat"
CALL :out_info Anri-chan updated.
)
SET nodb=n
IF NOT EXIST "%anri_dir%dfnd_titles.bat" SET nodb=y
IF NOT EXIST "%anri_dir%dfnd_data.bat" SET nodb=y
IF "%nodb%"=="y" (
	call :out_error The DFnD database was not found in anri-chan's data directory.
	GOTO :EOF
)
CALL :out_info Ignore "The" in a game's title when answering this question: in the case of games from the "The Legend of Zelda" series, enter Z. For .hack games, enter D.
:dfnd_letter
SET s=
SET /P s="Enter the first letter of the game's title: "
CALL :set_var_letter dfnd_letter dfnd_letter
:dfnd_list
CALL "%anri_dir%dfnd_titles.bat" | MORE
PAUSE
ECHO.
:dfnd_code
CALL :out_info If your game was not shown, enter L to select another letter or X to enter details manually. Enter R to repeat the list of games.
SET s=
SET /P s="Enter the game's code (shown at the left, not including the colon): "
IF /I "%s%"=="l" GOTO dfnd_letter
IF /I "%s%"=="x" GOTO :EOF
IF /I "%s%"=="r" GOTO dfnd_list
CALL "%anri_dir%dfnd_data.bat"
IF NOT "%dfnd_set%"=="y" (
	CALL :out_error A game with code %s% was not found.
	GOTO :dfnd_code
)
CALL :out_info Set data successfully.
PAUSE
GOTO :EOF


REM SUBROUTINES TO VALIDATE/SET VARIABLES

:set_var_bool
IF "%s%"=="y" (
	SET %1=y
	GOTO :EOF
)
IF "%s%"=="n" (
	SET %1=n
	GOTO :EOF
)
CALL :out_error Invalid value. Please enter Y (Yes) or N (No).
GOTO :%2

:set_var_letter
ECHO %s%|findStr /i "^[a-z]$">nul
IF %ERRORLEVEL%==0 (
	SET %1=%s%
	GOTO :EOF
) ELSE (
	CALL :out_error Invalid value. Please enter a single letter.
	GOTO :%2
)

:set_var_number
ECHO %s%|findStr "[^0-9]">nul
IF %ERRORLEVEL%==0 (
	CALL :out_error Invalid value. Please enter a number.
	GOTO :%2
)
IF "%3"=="" GOTO :napproved
IF %s% GTR %3% (
	CALL :out_error Invalid value. The maximum value is %3.
	GOTO :%2
)
:napproved
SET %1=%s%
GOTO :EOF

:set_var_nospace
ECHO %s%|findStr /c:" ">nul
IF %ERRORLEVEL%==0 (
	CALL :out_error Invalid value. You cannot have a space.
	GOTO :%2
) ELSE (
	SET %1=%s%
	GOTO :EOF
)

:set_var_notnull
IF "%s"=="" (
	CALL :out_error Invalid value. You must enter a value.
	GOTO :%2
) ELSE (
	SET %1=%s%
	GOTO :EOF
)

:set_var_in
ECHO %s%|findStr "^[%3]$">nul
IF %ERRORLEVEL%==0 (
	SET %1=%s%
	GOTO :EOF
) ELSE (
	CALL :out_error Invalid value. Please enter one of the suggested values only.
	GOTO :%2
)



REM FILE HANDLING

:make_projdir
CD "%curdir%"
IF NOT EXIST "%projname%" MD "%projname%"
CD "%projname%"
SET in_projdir=y
GOTO :EOF

:wipe_projdir
IF NOT "%in_projdir%"=="y" CALL :make_projdir
IF EXIST "%projname%.avs" DEL *.avs *.d2v *.wav
IF EXIST "%projname%_job.bat" DEL %projname%_job.bat
GOTO :EOF

:wipe_avs
IF EXIST "%projname%.avs" DEL *.avs
COPY /B "%projname%.bak" "%projname%.avs" 1> NUL
GOTO :EOF

:index_dvd
CALL :out_info anri-chan will now open DGMPGDec to index your DVD movie files. Once it is finished, anri-chan will continue.
PAUSE
IF "%vbo%"=="y" (
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\DVD_RTAV\VR_MOVIE.VRO] -OM=3 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template.avs] -exit
) ELSE (
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\VIDEO_TS\VTS_0%chapternumber%_1.VOB] -OM=3 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template.avs] -exit
)
MOVE /Y "%projname%.avs" "%projname%.bak"
GOTO :EOF

:index_dvd_mpa
IF "%vbo%"=="y" (
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\DVD_RTAV\VR_MOVIE.VRO] -OM=2 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template_mpa.avs] -exit
) ELSE (
"%PROGRAMFILES%\anrichan\dgmpgdec149\dgindex.exe" -AIF=[%driveletter%:\VIDEO_TS\VTS_0%chapternumber%_1.VOB] -OM=2 -OF=[%projname%] -AT=[%PROGRAMFILES%\anrichan\dgmpgdec149\template_mpa.avs] -exit
)
MOVE /Y "%projname%.avs" "%projname%.bak"
GOTO :EOF



:sball
CALL :wipe_avs
SET temp_files=y
IF "%dvdsource%"=="n" (
   COPY /B "%PROGRAMFILES%\anrichan\nondvdtemplate.avs" "%projname%.avs" 1> NUL
   ECHO directshowsource^("%avipath%"^).converttoyv12 >> "%projname%.avs"
)
TYPE "%PROGRAMFILES%\anrichan\ntscpal.txt" >> "%projname%.avs"
IF "%d%"=="4" TYPE "%PROGRAMFILES%\anrichan\d4.txt" >> "%projname%_temp.avs"
IF "%d%"=="1" TYPE "%PROGRAMFILES%\anrichan\d1.txt" >> "%projname%_temp.avs"
TYPE "%PROGRAMFILES%\anrichan\f1.txt" >> "%projname%_temp_2.avs"
IF "%prog%"=="y" (
TYPE "%PROGRAMFILES%\anrichan\deint_prog.txt" >> "%projname%_temp_2.avs"
GOTO itsprog
)
IF "%vhs%"=="y" ECHO nate_vhs_head_change_erase >> "%projname%_temp_2.avs"
IF "%odd%"=="y" (
	TYPE "%PROGRAMFILES%\anrichan\deint_odd.txt" >> "%projname%_temp_2.avs"
) ELSE TYPE "%PROGRAMFILES%\anrichan\deint.txt" >> "%projname%_temp_2.avs"
IF "%onepixel%"=="y" ECHO nate_1_pixel_bob_fix >> "%projname%_temp_2.avs"
IF "%gba%"=="y" ECHO nate_retard_bob_2 >> "%projname%_temp_2.avs"
IF "%gameboy%"=="y" ECHO nate_retard_bob_2 >> "%projname%_temp_2.avs"
IF "%deflicker%"=="y" ECHO nate_retard_bob_2 >> "%projname%_temp_2.avs"
IF "%nes%"=="y" ECHO nate_nes >> "%projname%_temp_2.avs"
TYPE "%PROGRAMFILES%\anrichan\resize.txt" >> "%projname%_temp_2.avs"
IF "%gba%"=="y" ECHO nate_gba >> "%projname%_temp_2.avs"
IF "%gameboy%"=="y" ECHO nate_gb >> "%projname%_temp_2.avs"
:itsprog
IF "%prog%"=="y" type "%PROGRAMFILES%\anrichan\fwhatever.txt" >> "%projname%_temp_2.avs"
ECHO changefps(f1/%f%) >> "%projname%_temp_2.avs"
ECHO run=converttoyv12 >> "%projname%_temp_2.avs"

COPY /B "%projname%.avs" "%projname%_trimtemp.avs" 1> NUL
ECHO bilinearresize(320,240) >> "%projname%_trimtemp.avs"
GOTO :EOF

:script_buildfiles
IF NOT "%temp_files%"=="y" CALL :sball
IF "%trim%"=="y" ECHO trim(%trim1%,%trim2%) >> "%projname%.avs"
IF "%gba%"=="y" GOTO gbastatid
IF "%gameboy%"=="y" GOTO gbstatid
ECHO statid=nate_statid_d1(run,"""%statid1%""","""%statid2%""","""%statid3%""").Lanczos4Resize(d1,run.height) >> "%projname%_temp_2.avs"
GOTO statidrefork
:gbastatid
ECHO statid=nate_statid_gba(run,"""%statid1%""","""%statid2%""","""%statid3%""").Lanczos4Resize(run.width,run.height) >> "%projname%_temp_2.avs"
GOTO statidrefork
:gbstatid
ECHO statid=nate_statid_gb(run,"""%statid1%""","""%statid2%""","""%statid3%""").Lanczos4Resize(run.width,run.height) >> "%projname%_temp_2.avs"
:statidrefork

IF "%statid%"=="y" (
ECHO statid++run++statid >> "%projname%_temp_2.avs"
) ELSE (
ECHO run >> "%projname%_temp_2.avs"
)

ECHO converttoyv12 >> "%projname%_temp_2.avs"

copy /B "%projname%.avs"+"%projname%_temp.avs"+"%projname%_temp_2.avs" "%projname%_HQ.avs" 1> NUL

TYPE "%PROGRAMFILES%\anrichan\d4.txt" >> "%projname%.avs"

REN "%projname%.avs" "%projname%_temp_f.avs"
COPY /B "%projname%_temp_f.avs"+"%projname%_temp_2.avs" "%projname%.avs" 1> NUL
DEL "%projname%_temp.avs" "%projname%_temp_2.avs" "%projname%_temp_f.avs" "%projname%_trimtemp.avs"

COPY /B "%projname%_HQ.avs" "%projname%_IQ.avs" 1> NUL

REM IF "%gba%"=="y" ECHO lanczos4resize(240,160) >> "%projname%.avs"

COPY /B "%projname%.avs" "%projname%_LQ.avs" 1> NUL

IF "%twod%"=="y" TYPE "%PROGRAMFILES%\anrichan\changef3.txt" >> "%projname%_LQ.avs"
IF "%twod%"=="n" (
TYPE "%PROGRAMFILES%\anrichan\changef2.txt" >> "%projname%.avs"
TYPE "%PROGRAMFILES%\anrichan\changef2.txt" >> "%projname%_LQ.avs"
)

copy /B "%projname%_LQ.avs" "%projname%_xvid.avs" 1> NUL
copy /B "%projname%_LQ.avs" "%projname%_LQ_xvid.avs" 1> NUL

GOTO :EOF


REM SETTINGS MANAGER

:find_existing_settings
IF EXIST "%curdir%\%projname%\%projname%_job.bat" (
	CALL "%curdir%\%projname%\%projname%_job.bat"
	SET using_settings=y
)
GOTO :EOF

:show_settings
CALL :out_cls_section REVIEW SETTINGS
IF NOT "%this_anriver%"=="" IF NOT "%this_anriver%"=="%anri_ver%" CALL :out_info NOTICE: Your settings for this project were created in an outdated version of Anri-chan. They may not work properly in this version. It is recommended that you discard these settings and re-enter them.
IF "%dvdsource%"=="y" (
	CALL :out_info DVD Source: Yes
) ELSE (
	CALL :out_info DVD Source: No
)
IF "%dvdsource%"=="y" (
	CALL :out_info DVD Drive Letter: %driveletter%
	IF "%vbo%"=="y" (
		CALL :out_info DVD-RAM .VRO Source: Yes
	) ELSE (
		CALL :out_info DVD-RAM .VRO Source: No
	)
	IF NOT "%chapternumber%"=="" CALL :out_info DVD Chapter Number: %chapternumber%
)
CALL :out_info Project Name: %projname%
IF NOT "%avipath%"=="" CALL :out_info Source Video File: %avipath%
IF NOT "%twod%"=="y" (
SET twodtemp=3D
) ELSE SET twodtemp=2D
IF NOT "%d%%f%"=="" CALL :out_info Video Format: D%d% F%f% %twodtemp%
IF "%vhs%"=="y" (
	CALL :out_info From VHS Source
) ELSE (
	CALL :out_info Not From VHS Source
)
IF "%prog%"=="y" (
	CALL :out_info Progressive
) ELSE (
	CALL :out_info Interlaced
)
IF "%odd%"=="y" CALL :out_info Odd Dominant
IF "%onepixel%"=="y" CALL :out_info One-Pixel Bob
IF "%nes%"=="y" CALL :out_info From NES Console
IF "%gba%"=="y" CALL :out_info From Game Boy Advance
IF "%gameboy%"=="y" CALL :out_info From Game Boy
IF "%trim%"=="y" CALL :out_info Trim from frames %trim1% to %trim2%
IF "%statid%"=="y" CALL :out_info StatID: %statid1% / %statid2% / %statid3%
GOTO :EOF

:check_settings
CALL :show_settings
:check_settings_p2
SET s=
SET /P s=Do you want to encode using these settings? If you choose No you will be prompted to enter them again. [y/n] 
CALL :set_var_bool settings_good check_settings_p2
GOTO :EOF

:savesettings
ECHO @ECHO OFF > "%projname%_job.bat"
ECHO ^(SET proj_anriver=%anri_ver%^) >> "%projname%_job.bat"
ECHO ^(SET using_settings=y^) >> "%projname%_job.bat"
ECHO ^(SET dvdsource=%dvdsource%^) >> "%projname%_job.bat"
ECHO ^(SET avipath=%avipath%^) >> "%projname%_job.bat"
ECHO ^(SET d=%d%^) >> "%projname%_job.bat"
ECHO ^(SET f=%f%^) >> "%projname%_job.bat"
ECHO ^(SET vhs=%vhs%^) >> "%projname%_job.bat"
ECHO ^(SET onepixel=%onepixel%^) >> "%projname%_job.bat"
ECHO ^(SET nes=%nes%^) >> "%projname%_job.bat"
ECHO ^(SET twod=%twod%^) >> "%projname%_job.bat"
ECHO ^(SET statid=%statid%^) >> "%projname%_job.bat"
ECHO ^(SET statid1=%statid1%^) >> "%projname%_job.bat"
ECHO ^(SET statid2=%statid2%^) >> "%projname%_job.bat"
ECHO ^(SET statid3=%statid3%^) >> "%projname%_job.bat"
ECHO ^(SET driveletter=%driveletter%^) >> "%projname%_job.bat"
ECHO ^(SET chapternumber=%chapternumber%^) >> "%projname%_job.bat"
ECHO ^(SET projname=%projname%^) >> "%projname%_job.bat"
ECHO ^(SET gba=%gba%^) >> "%projname%_job.bat"
ECHO ^(SET gb=%gameboy%^) >> "%projname%_job.bat"
ECHO ^(SET odd=%odd%^) >> "%projname%_job.bat"
ECHO ^(SET dvdsource=%dvdsource%^) >> "%projname%_job.bat"
ECHO ^(SET vbo=%vbo%^) >> "%projname%_job.bat"
ECHO ^(SET prog=%prog%^) >> "%projname%_job.bat"
ECHO ^(SET trim=%trim%^) >> "%projname%_job.bat"
ECHO ^(SET trim1=%trim1%^) >> "%projname%_job.bat"
ECHO ^(SET trim2=%trim2%^) >> "%projname%_job.bat"
ECHO IF NOT "%%in_anrichan%%"=="y" CALL "%anri_path%" >> "%projname%_job.bat"
GOTO :EOF

:createjob
CALL :savesettings
PAUSE
GOTO die


REM QUALITIES SELECTION

:selectquality
SET s=
SET /P s="Create %1 (%2Kbps) movie? "
IF "%s%"=="y" (
	SET create_%3=y
	GOTO :EOF
)
IF "%s%"=="n" (
	SET create_%3=n
	GOTO :EOF
)
CALL :out_error Invalid value. Please enter Y (Yes) or N (No).
GOTO :selectquality %1 %2 %3

:select_qualities
CALL :savesettings
CALL :selectquality Low-Quality 192 lq
CALL :selectquality Normal-Quality 576 mq
CALL :selectquality High-Quality 2176 hq
IF NOT "%d%"=="1" SET create_iq=n
IF NOT "%f%"=="1" SET create_iq=n
IF "%gba%"=="y" SET create_iq=n
IF "%gameboy%"=="y" SET create_iq=n
IF NOT "%create_iq%"=="n" CALL :selectquality Insane-Quality 5320 iq
CALL :selectquality XviD-Low-Quality 192 xl
CALL :selectquality XviD-Normal-Quality 576 xm
REM was having trouble with this getting stuck on so i just made it go to the encoding section anyway even if there's nothing to encode
REM IF NOT "%create_lq%"=="y" IF NOT "%create_mq%"=="y" IF NOT "%create_hq%"=="y" IF NOT "%create_iq%"=="y" IF NOT "%create_xl%"=="y" IF NOT "%create_xm%"=="y" SET not_encoding=y
GOTO :EOF

REM ENCODING

:encode_movies
CALL :out_section encoding %projname%

REM thanks snow!
IF "%create_lq%"=="y" (
CALL :out_section encoding %projname% LQ MP4
CALL :2pass %projname%_LQ.avs %projname%_LQ       128  64000  17 1 1
)
IF "%create_mq%"=="y" (
CALL :out_section encoding %projname% MQ MP4
CALL :2pass %projname%.avs    %projname%          512  64000  17 1 1
)
IF "%create_hq%"=="y" (
CALL :out_section encoding %projname% HQ MP4
CALL :2pass %projname%_HQ.avs %projname%_HQ      2048 128000  17 1 1
)
IF "%create_iq%"=="y" (
CALL :out_section encoding %projname% IQ MP4
CALL :2pass %projname%_IQ.avs %projname%_IQ      5000 320000  19 1 1
)

REM back to nate's work (based on snow's though!)
IF "%create_xl%"=="y" (
CALL :out_section encoding %projname% LQ AVI
CALL :xvid %projname%_LQ_xvid.avs %projname%_LQ   128     64   1 1
)
IF "%create_xm%"=="y" (
CALL :out_section encoding %projname% MQ AVI
CALL :xvid %projname%_xvid.avs %projname%         512     64   1 1
)

GOTO :EOF


:2pass
"%PROGRAMFILES%\anrichan\x264.exe" --pass 1 --bitrate %3 --stats "%2.stats" --bframes 16 --analyse none --qpmin %5 --threads auto --thread-input --progress --no-psnr --no-ssim --output NUL "%1"
"%PROGRAMFILES%\anrichan\x264.exe" --pass 2 --bitrate %3 --stats "%2.stats" --direct auto --ref 8 --mixed-refs --no-fast-pskip --bframes 16 --b-rdo --bime --weightb --subme 7 --trellis 2 --analyse all --qpmin %5 --me umh --threads auto --thread-input --progress --no-psnr --output "%2_video.mp4" "%1"
"%PROGRAMFILES%\anrichan\virtualdub-1.7.1\vdub.exe" "%1" /i "%PROGRAMFILES%\anrichan\audioout.vcf" "%2_temp.wav"
"%PROGRAMFILES%\anrichan\neroAacEnc.exe" -br %4 -lc -if "%2_temp.wav" -of "%2_audio.mp4"
"%PROGRAMFILES%\anrichan\MP4Box.exe" -tmp . -new -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4"
IF "%6" == "1" del %2.stats
IF "%7" == "1" del %2_video.mp4 | del %2_temp.wav | del %2_audio.mp4
GOTO :EOF

:xvid
"%PROGRAMFILES%\anrichan\xvid_encraw.exe" -i "%1" -bitrate %3 -pass1 "%2.stats"
"%PROGRAMFILES%\anrichan\xvid_encraw.exe" -i "%1" -bitrate %3 -pass2 "%2.stats" -avi "%2v.avi"
"%PROGRAMFILES%\anrichan\ffmpeg.exe" -b %4 -ac 2 -acodec mp3 -y -i "%2v.avi" -vcodec copy -i "%1" "%2.avi"
IF "%5" == "1" del "%2.stats"
IF "%6" == "1" del "%2v.avi"
GOTO :EOF


REM OUTPUT

:out_cls
CLS
ECHO.
ECHO ===============================================================================
ECHO.                 metroid 2002 speed demos archive anri-chan %anri_ver%
ECHO.        http://www.metroid2002.com/     http://speeddemosarchive.com/
ECHO ===============================================================================
ECHO.
GOTO :EOF

:out_info
ECHO %*
REM ECHO.
GOTO :EOF

:out_error
ECHO [!]
ECHO [!] %*
ECHO [!]
ECHO.
GOTO :EOF

:out_section
TITLE anri-chan %anri_ver% - %*
ECHO -------------------------
ECHO. %*
ECHO -------------------------
ECHO.
GOTO :EOF

:out_cls_section
CALL :out_cls
CALL :out_section %*
GOTO :EOF

:out_cls_info
CALL :out_cls
CALL :out_info %*
GOTO :EOF


REM OTHER

:start_encode_test
IF "%start_encode%"=="y" GOTO proc_encode
IF NOT "%start_encode%"=="y" GOTO proc_close

:resetvars
FOR %%A IN (%vars_to_use%) DO (SET %%A=)
GOTO :EOF

:die
CALL :resetvars
(SET in_anrichan=)
CD %curdir%
TITLE anri-chan dun ^^_^^
PAUSE
Personal tools