Created
March 15, 2023 21:25
-
-
Save anzz1/e99fbce668ea72018ac967a3dc3ba9e9 to your computer and use it in GitHub Desktop.
gif.bat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if [%~1]==[] echo gif: No input file specified.&exit /b 1 | |
:loop | |
if [%~x1]==[.gif] (set "_outfile=%~n1_1.gif") else (set "_outfile=%~n1.gif") | |
ffmpeg -hide_banner -vsync 0 -i "%~1" -vf "fps=20,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 -final_delay 300 -f gif "%_outfile%" || call :chksz "%_outfile%" | |
shift | |
if not [%~1]==[] goto loop | |
goto :eof | |
:chksz | |
if [%~z1]==[0] del "%~1" | |
exit /b 0 | |
:eof | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment