Last active
July 20, 2021 12:09
-
-
Save ecmjohnson/d41ada89c22ed84631ecdeb753ec9f04 to your computer and use it in GitHub Desktop.
Translation of nerdyrodent/VQGAN-CLIP/zoom.sh to Windows Batch Scripting
This file contains 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 | |
:: needed to modify variables in a for loop | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
:: command line options | |
SET TEXT=%~1 | |
SET FILENAME=%~2 | |
SET MAX_EPOCHS=%~3 | |
:: hardcoded options | |
SET MAX_ITERATIONS=50 | |
SET SEED=42 | |
:: only supports 3 character extensions (e.g. .png or .jpg) | |
SET FILENAME_NO_EXT=%FILENAME:~0,-4% | |
SET FILE_EXTENSION=%FILENAME:~-4% | |
:: create the starting image | |
python generate.py -p="%TEXT%" -i=%MAX_ITERATIONS% -se=%MAX_ITERATIONS% --seed=%SEED% -o="%FILENAME%" | |
COPY "%FILENAME%" "%FILENAME_NO_EXT%-0000%FILE_EXTENSION%" | |
magick convert "%FILENAME%" -distort SRT 1.01,0 -gravity center "%FILENAME%" | |
magick convert "%FILENAME%" -distort SRT 1 -gravity center "%FILENAME%" | |
:: feedback image loop | |
for /l %%i in (1, 1, %MAX_EPOCHS%) do ( | |
SET EXTEND_COUNT=000%%i | |
SET PADDED_COUNT=!EXTEND_COUNT:~-4! | |
python generate.py -p="%TEXT%" -i=%MAX_ITERATIONS% -se=%MAX_ITERATIONS% --seed=%SEED% -ii="%FILENAME%" -o="%FILENAME%" | |
COPY "%FILENAME%" "%FILENAME_NO_EXT%-!PADDED_COUNT!%FILE_EXTENSION%" | |
magick convert "%FILENAME%" -distort SRT 1.01,0 -gravity center "%FILENAME%" | |
magick convert "%FILENAME%" -distort SRT 1 -gravity center "%FILENAME%" | |
) | |
:: make video - Nvidia GPU expected | |
ffmpeg -y -i "%FILENAME_NO_EXT%-%%04d%FILE_EXTENSION%" -b:v 8M -c:v h264_nvenc -pix_fmt yuv420p -strict -2 -filter:v minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=60' video.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment