Mercurial > codedump
comparison tenormoment.bat @ 14:44a37d846d80
make tenormoment.bat actually functional
committer: GitHub <noreply@github.com>
| author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
|---|---|
| date | Fri, 26 Mar 2021 00:10:57 -0400 |
| parents | b067eadd5715 |
| children | 04b0c3437ca1 |
comparison
equal
deleted
inserted
replaced
| 13:8852a4a26ffa | 14:44a37d846d80 |
|---|---|
| 1 @if [%1] == [] goto usage | 1 @echo off |
| 2 @if not exist "%1" goto usage | 2 REM - file checks |
| 3 @if not "%2" == "--debug" @echo off | 3 if [%1] == [] echo usage: %0 ^<video^> |
| 4 if not exist %1 echo usage: %0 ^<video^> | |
| 4 setlocal enabledelayedexpansion | 5 setlocal enabledelayedexpansion |
| 5 set "time=0" | 6 set "time=0" |
| 7 | |
| 8 REM - folder checks | |
| 6 :question | 9 :question |
| 7 if not exist "%~n1" goto start | 10 if not exist "%~n1" goto start |
| 8 set /p "answer=The folder '%~n1' already exists. Would you like to overwrite or merge the contents? [o/m]: " | 11 set /p "answer=The folder '%~n1' already exists. Would you like to overwrite or merge the contents? [o/m]: " |
| 9 if "%answer%" == "o" ( | 12 if "%answer%" == "o" ( |
| 10 del /f /s /q "%~n1" | 13 del /f /s /q "%~n1" |
| 11 goto start | 14 goto start |
| 12 ) | 15 ) |
| 13 if "%answer%" == "m" goto start | 16 if "%answer%" == "m" goto start |
| 14 goto question | 17 goto question |
| 15 | 18 |
| 16 | 19 REM - |
| 17 :start | 20 :start |
| 18 if not exist "%~n1" mkdir "%~n1" | 21 if not exist "%~n1" mkdir "%~n1" |
| 19 ffmpeg -i "%1" -y -t 5 -ss %time% -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "%~n1\gif_%time%.gif" | 22 ffmpeg -i %1 -y -t 5 -ss %time% -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "%~n1\gif_%time%.gif" |
| 20 for /F "tokens=*" %%F in ("%~n1\gif_%time%.gif") do set "size=%~z1" | 23 for /F "tokens=*" %%F in ("%~n1\gif_%time%.gif") do set "size=%%~zF" |
| 21 echo %~z1 and !size! | |
| 22 if "!size!" == "0" ( | 24 if "!size!" == "0" ( |
| 23 del "%~n1\gif_%time%.gif" | 25 del "%~n1\gif_%time%.gif" |
| 24 exit /B | 26 exit /B |
| 25 ) | 27 ) |
| 26 set /a "time=%time%+5" | 28 set /a "time=%time%+5" |
| 27 goto start | 29 goto start |
| 28 | |
| 29 :usage | |
| 30 echo usage: %0 ^<video^> |
