updates
This commit is contained in:
@@ -71,6 +71,11 @@ s::Send("{Down}")
|
||||
d::Send("{Right}")
|
||||
#HotIf ; End
|
||||
|
||||
; Handle RMB click if menu already showing
|
||||
#HotIf WinExist("ahk_class #32768")
|
||||
RButton::Send("{F13 Down}{Click,right}{F13 Up}")
|
||||
#HotIf ; End
|
||||
|
||||
; Unit Dashboard
|
||||
;#HotIf WinActive("ahk_class TfUnitDashboardNew")
|
||||
;q::Send("{F4}") ; Q - Close Unit Dashboard
|
||||
|
||||
+56
-47
@@ -23,15 +23,19 @@ SET "mode="
|
||||
SET "dither="
|
||||
SET "bayerscale="
|
||||
SET "start_time="
|
||||
SET "end_time="
|
||||
SET "webp_lossy="
|
||||
SET "duration="
|
||||
SET "colormax="
|
||||
SET "version="
|
||||
SET "build="
|
||||
|
||||
:: Setting the path to the Working Directory and storing FFmpeg Version String
|
||||
:: Setting the path to the Working Directory
|
||||
SET WD=%TEMP%\VID2ANI
|
||||
SET palette=%WD%\template
|
||||
|
||||
:: Palette filename
|
||||
SET palette=%WD%\palette
|
||||
|
||||
:: Storing FFmpeg version string
|
||||
FOR /F "delims=" %%a in ('ffmpeg -version') DO (
|
||||
IF NOT DEFINED version (
|
||||
SET "version=%%a"
|
||||
@@ -82,9 +86,9 @@ ECHO [96m(Default for WebP is lossless)[0m
|
||||
ECHO -c The maximum amount of colors useable per palette.
|
||||
ECHO [96m(Optional value up to 256)[0m
|
||||
ECHO [33mThis option isn't used by default.[0m
|
||||
ECHO -s Start of the animation (HH:MM:SS.MS)
|
||||
ECHO -s Start time of the animation (HH:MM:SS.MS)
|
||||
ECHO [96m(Optional)[0m
|
||||
ECHO -e Duration of the animation (HH:MM:SS.MS)
|
||||
ECHO -e End time of the animation (HH:MM:SS.MS)
|
||||
ECHO [96m(Optional)[0m
|
||||
ECHO -k Enables error diffusion.
|
||||
ECHO [96m(Optional)[0m
|
||||
@@ -141,7 +145,7 @@ IF NOT "%~1" =="" (
|
||||
IF "%~1" =="-t" SET "filetype=%~2" & SHIFT
|
||||
IF "%~1" =="-o" SET "output=%~dpnx2" & SHIFT
|
||||
IF "%~1" =="-s" SET "start_time=%~2" & SHIFT
|
||||
IF "%~1" =="-e" SET "duration=%~2" & SHIFT
|
||||
IF "%~1" =="-e" SET "end_time=%~2" & SHIFT
|
||||
IF "%~1" =="-c" SET "colormax=%~2" & SHIFT
|
||||
IF "%~1" =="-l" SET "webp_lossy=%~2" & SHIFT
|
||||
IF "%~1" =="-k" SET "errorswitch=0"
|
||||
@@ -161,20 +165,27 @@ GOTO :safchek
|
||||
|
||||
:safchek
|
||||
:: Setting a clear range of acceptable setting values and noob proofing bayerscale
|
||||
|
||||
:: Output file type
|
||||
echo %filetype% | findstr /r "\<gif\> \<png\> \<apng\> \<webp\>" >nul
|
||||
IF %errorlevel% NEQ 0 (
|
||||
ECHO [91mNot a valid file type[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
IF "%filetype%"=="png" SET filetype=apng
|
||||
IF "%filetype%"=="apng" SET output=%output%.png
|
||||
IF "%filetype%"=="webp" SET output=%output%.webp
|
||||
IF "%filetype%"=="gif" SET output=%output%.gif
|
||||
|
||||
:: Palettegen
|
||||
IF %mode% GTR 3 (
|
||||
ECHO [91mNot a valid mode[0m
|
||||
ECHO [91mNot a valid palettegen mode[0m
|
||||
GOTO :EOF
|
||||
) ELSE IF %mode% LSS 1 (
|
||||
ECHO [91mNot a valid mode[0m
|
||||
ECHO [91mNot a valid palettegen mode[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
|
||||
:: Dithering
|
||||
IF %dither% GTR 8 (
|
||||
ECHO [91mNot a valid dither algorithm[0m
|
||||
GOTO :EOF
|
||||
@@ -183,6 +194,24 @@ IF %dither% GTR 8 (
|
||||
GOTO :EOF
|
||||
)
|
||||
|
||||
:: Bayerscale
|
||||
IF DEFINED bayerscale (
|
||||
IF !bayerscale! GTR 5 (
|
||||
ECHO [91mNot a valid bayerscale value[0m
|
||||
GOTO :EOF
|
||||
) ELSE IF !bayerscale! LSS 0 (
|
||||
ECHO [91mNot a valid bayerscale value[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
IF !bayerscale! LEQ 5 (
|
||||
IF %dither% NEQ 1 (
|
||||
ECHO [91mThis setting only works with bayer dithering[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
:: Lossy WEBP
|
||||
IF DEFINED webp_lossy (
|
||||
IF NOT "%filetype%" == "webp" (
|
||||
ECHO [91mLossy is only valid for filetype webp[0m
|
||||
@@ -196,32 +225,25 @@ IF DEFINED webp_lossy (
|
||||
)
|
||||
)
|
||||
|
||||
IF DEFINED bayerscale (
|
||||
IF !bayerscale! GTR 5 (
|
||||
ECHO [91mNot a valid bayerscale value[0m
|
||||
GOTO :EOF
|
||||
) ELSE IF !bayerscale! LSS 0 (
|
||||
ECHO [91mNot a valid bayerscale value[0m
|
||||
:: Noob Proofing clipping
|
||||
IF DEFINED start_time (
|
||||
IF DEFINED end_time SET "trim=-ss !start_time! -to !end_time!"
|
||||
IF NOT DEFINED end_time (
|
||||
ECHO [91mPlease input the end time[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
IF !bayerscale! LEQ 5 (
|
||||
IF %dither% EQU 1 GOTO :script_start
|
||||
IF %dither% NEQ 1 (
|
||||
ECHO [91mThis setting only works with bayer dithering[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
)
|
||||
|
||||
IF NOT DEFINED start_time (
|
||||
IF DEFINED end_time (
|
||||
ECHO [91mPlease input the start time[0m
|
||||
GOTO :EOF
|
||||
)
|
||||
)
|
||||
GOTO :script_start
|
||||
|
||||
:script_start
|
||||
:: Set output file name
|
||||
IF "%filetype%"=="png" SET filetype=apng
|
||||
IF "%filetype%"=="apng" SET output=%output%.png
|
||||
IF "%filetype%"=="webp" SET output=%output%.webp
|
||||
IF "%filetype%"=="gif" SET output=%output%.gif
|
||||
|
||||
:: Displaying FFmpeg Version String and Creating the Working Directory
|
||||
:: Displaying FFmpeg version string and creating the working directory
|
||||
ECHO [33m%version%[0m
|
||||
ECHO [33m%build%[0m
|
||||
ECHO [32mOutput file: %output%[0m
|
||||
@@ -229,30 +251,16 @@ ECHO [32mCreating Working Directory...[0m
|
||||
MD "%WD%"
|
||||
|
||||
:palettegen
|
||||
:: Noob Proofing clipping
|
||||
IF DEFINED start_time (
|
||||
IF DEFINED duration SET "trim=-ss !start_time! -t !duration!"
|
||||
IF NOT DEFINED duration (
|
||||
ECHO [35mPlease input a duration[0m
|
||||
GOTO :cleanup
|
||||
)
|
||||
)
|
||||
|
||||
IF NOT DEFINED start_time (
|
||||
IF DEFINED duration (
|
||||
ECHO [35mPlease input a start time[0m
|
||||
GOTO :cleanup
|
||||
)
|
||||
)
|
||||
|
||||
:: Putting together command to generate palette
|
||||
SET frames=%palette%_%%05d
|
||||
SET filters=fps=%fps%,scale=%scale%:-1:flags=lanczos
|
||||
|
||||
:: Palettegen mode
|
||||
IF %mode% EQU 1 SET encode=palettegen=stats_mode=diff
|
||||
IF %mode% EQU 2 SET encode="palettegen=stats_mode=single"
|
||||
IF %mode% EQU 3 SET encode=palettegen
|
||||
|
||||
:: Max colors
|
||||
IF DEFINED colormax (
|
||||
IF %mode% LEQ 2 SET "mcol=:max_colors=%colormax%"
|
||||
IF %mode% EQU 3 SET "mcol==max_colors=%colormax%"
|
||||
@@ -270,26 +278,27 @@ IF NOT EXIST "%palette%_00001.png" (
|
||||
)
|
||||
)
|
||||
|
||||
:: Setting variables to put the command together
|
||||
:: Setting variables to put the encode command together
|
||||
:: Checking for Error Diffusion if using Bayer Scale and adjusting the command accordingly
|
||||
IF %mode% EQU 1 SET decode=paletteuse
|
||||
IF %mode% EQU 2 SET "decode=paletteuse=new=1"
|
||||
IF %mode% EQU 3 SET decode=paletteuse
|
||||
|
||||
:: Error diffusion
|
||||
IF DEFINED errorswitch (
|
||||
IF %mode% EQU 1 SET "errordiff==diff_mode=rectangle"
|
||||
IF %mode% EQU 2 SET "errordiff=:diff_mode=rectangle"
|
||||
IF %mode% EQU 3 SET "errordiff==diff_mode=rectangle"
|
||||
)
|
||||
|
||||
:: Setting WEBP lossy arguments
|
||||
:: WEBP pixel format and lossy quality
|
||||
IF "%filetype%" == "webp" (
|
||||
IF DEFINED webp_lossy (
|
||||
SET "webp_lossy=-lossless 0 -pix_fmt yuv420p -quality %webp_lossy%"
|
||||
) ELSE SET "webp_lossy=-lossless 1"
|
||||
)
|
||||
|
||||
:: Setting dither algorithm
|
||||
:: Dither algorithm
|
||||
IF %dither% EQU 0 SET ditheralg=none
|
||||
IF %dither% EQU 1 SET ditheralg=bayer
|
||||
IF %dither% EQU 2 SET ditheralg=heckbert
|
||||
|
||||
Reference in New Issue
Block a user