Skip to content

Instantly share code, notes, and snippets.

@wiiaboo
Created December 8, 2011 22:57
Show Gist options
  • Save wiiaboo/1449101 to your computer and use it in GitHub Desktop.
Save wiiaboo/1449101 to your computer and use it in GitHub Desktop.
Fraps encoding script
@echo off
set debug=0
color 07
if %debug% == 1 echo [DEBUG MODE]
echo ***********************************************************
echo *
echo * ########################
echo * # FRAPS Encoding Batch #
echo * ########################
echo *
echo * Encode every Fraps videos in the current directory (*.avi)
echo * to H.264.mkv / FLAC and mux the streams into MKV
echo *
echo * REQUIRES : FFmpeg, x264, MkvMerge
echo *
echo ***********************************************************
echo.
REM #############################
REM #_____________ LOOP _________________
REM #############################
for %%f in (*.avi) do (
color 07
call :audio "%%f"
REM :video "[file]" [CRF:{16-23}] [x264_preset:{ultrafast|superfast|veryfast|faster|medium|slow|slower|veryslow|placebo}] [process_priority:{high|normal|low}]
call :video "%%f" 16 slow normal
call :next
)
goto :eof
REM #############################
REM #_____________ STEPS ________________
REM #############################
:audio
echo File processed : %1
echo.
echo.
echo.
echo ********************
echo * Audio encoding...
echo ********************
echo.
echo ffmpeg -i %1 -vn -y "%~n1.flac"
if %debug%==1 (
REM Output encoding info to a separate window
ffmpeg -i %1 -vn -y "%~n1.flac"
)else (
REM Output encoding info to the CLI
start /wait /min ffmpeg -i %1 -vn -y "%~n1.flac"
)
echo.
if not %ERRORLEVEL% == 0 (
echo ### Error in audio process ! ###
goto :error
)
if %debug% == 1 pause
goto :eof
:video
echo.
echo.
echo ********************
echo * Video encoding...
echo ********************
echo.
echo x264 --preset %3 --crf %2 --output "%~n1.mkv" --audiofile "%~n1.flac" --acodec copy %1
if %debug% == 0 (
REM Output encoding info to a separate window
start /wait /min /%4 x264 --preset %3 --crf %2 --output "%~n1.mkv" --audiofile "%~n1.flac" --acodec copy %1
)else (
REM Output encoding info to the CLI
echo.
x264 --preset %3 --crf %2 --output "%~n1.mkv" --audiofile "%~n1.flac" --acodec copy %1
)
echo.
if not %ERRORLEVEL% == 0 (
echo ### Error in video process ! ###
goto :error
)
if %debug%==0 (del *.flac) & (del %1)
if %debug% == 1 pause
goto :eof
:error
color 74
echo.
pause
exit
:next
color 0A
echo.
echo.
echo *********************************
echo * Successful Video Encoding !
echo *********************************
echo.
echo Processing next video in 5 seconds...
ping localhost -n 6 > NUL
cls
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment