109 lines
3.8 KiB
Batchfile
109 lines
3.8 KiB
Batchfile
@echo off
|
||
|
||
:: Sets the variables for what charcteristics your frames are. You shouldn't need to mess with LOGO_FRAMERATE, but if your
|
||
:: frame names are different from say, CSP's (Where the default naming scheme isn't 'Timeline 1_XXXX'), this is where you change
|
||
:: them. LOGO_FRAME_DIGITS refers to how many digits at the end of the base frame name are in a collection, so for instance CSP's
|
||
:: goes from 0000 - 9999, which is 4 digits.
|
||
|
||
set "LOGO_FRAME_RATE=30"
|
||
set "LOGO_FRAME_STARTING_NUMBER=0"
|
||
set "LOGO_FRAME_BASENAME=Timeline 1_"
|
||
set "LOGO_FRAME_DIGITS=4"
|
||
set "LOGO_FRAME_EXTENSION=.png"
|
||
:: Set this to TRUE if you want to shrink it down
|
||
set "LOGO_FRAME_HALFRES=FALSE"
|
||
|
||
|
||
|
||
|
||
|
||
|
||
:: The filepaths for the frame and video folders
|
||
:: This will end up with a filepath like "logo_frames\\Timeline 1_0000.png" for frames
|
||
|
||
set "LOGO_PATH_FRAMES=logoalt_frames\\%LOGO_FRAME_BASENAME%%%0%LOGO_FRAME_DIGITS%d%LOGO_FRAME_EXTENSION%"
|
||
set "LOGO_PATH_VIDEO_LOSSLESS=export_lossless\\titlealt lossless.mp4"
|
||
set "LOGO_PATH_VIDEO_MASK_LOSSLESS=export_lossless\\titlealtmask lossless.mp4"
|
||
set "LOGO_PATH_VIDEO_GAME=export_game\\anim_logoalt1.webm"
|
||
set "LOGO_PATH_VIDEO_MASK_GAME=export_game\\anim_logoaltmask.mp4"
|
||
|
||
|
||
:: Set the command for scaling the video down half res
|
||
if "%LOGO_FRAME_HALFRES%"=="TRUE" (set "LOGO_HALFRES_COMMAND=scale=iw/2:ih/2")
|
||
if "%LOGO_FRAME_HALFRES%"=="FALSE" (set "LOGO_HALFRES_COMMAND=scale=iw:ih")
|
||
|
||
|
||
:: First we make the RGB video of the logo in lossless format, so it (on paper) should be pixel accurate to the frames.
|
||
|
||
if exist "%LOGO_PATH_VIDEO_LOSSLESS%" del "%LOGO_PATH_VIDEO_LOSSLESS%"
|
||
|
||
ffmpeg ^
|
||
-framerate %LOGO_FRAME_RATE% ^
|
||
-start_number %LOGO_FRAME_STARTING_NUMBER% ^
|
||
-i "%LOGO_PATH_FRAMES%" ^
|
||
-c:v libx264 -pix_fmt yuv444p -colorspace bt709 -crf 0 ^
|
||
-filter:v %LOGO_HALFRES_COMMAND% ^
|
||
"%LOGO_PATH_VIDEO_LOSSLESS%"
|
||
if NOT ["%errorlevel%"]==["0"] goto:error
|
||
echo [92m%~n1Done converting logo mask to lossless video.[0m
|
||
|
||
:: Then we do it again, but make an alpha mask video out of those frames
|
||
|
||
if exist "%LOGO_PATH_VIDEO_MASK_LOSSLESS%" del "%LOGO_PATH_VIDEO_MASK_LOSSLESS%"
|
||
|
||
ffmpeg ^
|
||
-framerate %LOGO_FRAME_RATE% ^
|
||
-start_number %LOGO_FRAME_STARTING_NUMBER% ^
|
||
-i "%LOGO_PATH_FRAMES%" ^
|
||
-c:v libx264 -pix_fmt yuv444p -colorspace bt709 -crf 0 ^
|
||
-filter:v "alphaextract, %LOGO_HALFRES_COMMAND%" ^
|
||
"%LOGO_PATH_VIDEO_MASK_LOSSLESS%"
|
||
if NOT ["%errorlevel%"]==["0"] goto:error
|
||
echo [92m%~n1Done converting logo mask to lossless video.[0m
|
||
|
||
|
||
|
||
:: Now we convert those lossless videos to game-usable videos
|
||
|
||
if exist "%LOGO_PATH_VIDEO_GAME%" del "%LOGO_PATH_VIDEO_GAME%"
|
||
|
||
ffmpeg ^
|
||
-i "%LOGO_PATH_VIDEO_LOSSLESS%" ^
|
||
-pix_fmt yuv420p10le -c:v vp9 -deadline good -cpu-used 0 -row-mt 1 -tile-columns 2 -lag-in-frames 25 -keyint_min 240 -auto-alt-ref 6 -arnr-maxframes 12 -enable-tpl 1 -colorspace bt709 -b:v 0 -crf 31 ^
|
||
"%LOGO_PATH_VIDEO_GAME%"
|
||
if NOT ["%errorlevel%"]==["0"] goto:error
|
||
echo [92m%~n1Done converting logo to game usable video.[0m
|
||
|
||
:: And again for the mask
|
||
|
||
if exist "%LOGO_PATH_VIDEO_MASK_GAME%" del "%LOGO_PATH_VIDEO_MASK_GAME%"
|
||
|
||
ffmpeg ^
|
||
-i "%LOGO_PATH_VIDEO_MASK_LOSSLESS%" ^
|
||
-c:v mpeg4 -colorspace bt709 -qscale:v 10 -an ^
|
||
"%LOGO_PATH_VIDEO_MASK_GAME%"
|
||
if NOT ["%errorlevel%"]==["0"] goto:error
|
||
echo [92m%~n1Done converting logo mask to game usable video.[0m
|
||
|
||
:: Rename the files to webm for Ren'Py. FFMPEG won't allow you to just specifiy a .webm on an mpeg4 file
|
||
if exist "export_game\\anim_logoaltmask.webm" del "export_game\\anim_logoaltmask.webm"
|
||
ren "%LOGO_PATH_VIDEO_MASK_GAME%" "anim_logoaltmask.webm"
|
||
|
||
echo [92m%~n1Successfully changed extension of game-usable videos.[0m
|
||
|
||
goto:end
|
||
|
||
|
||
|
||
|
||
:error
|
||
|
||
echo [93mThere was an error. Please check your input files or your FFMPEG isn't in this folder/not part of your environment variables.[0m
|
||
pause
|
||
exit 0
|
||
|
||
:end
|
||
|
||
echo [92mEncoding succesful.[0m
|
||
pause
|
||
exit 0 |