Mercurial > codedump
comparison tenormoment.bat @ 15:04b0c3437ca1
Update tenormoment.bat
committer: GitHub <noreply@github.com>
| author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
|---|---|
| date | Fri, 26 Mar 2021 00:13:11 -0400 |
| parents | 44a37d846d80 |
| children |
comparison
equal
deleted
inserted
replaced
| 14:44a37d846d80 | 15:04b0c3437ca1 |
|---|---|
| 1 @echo off | 1 @echo off |
| 2 REM - file checks | |
| 3 if [%1] == [] echo usage: %0 ^<video^> | |
| 4 if not exist %1 echo usage: %0 ^<video^> | |
| 5 setlocal enabledelayedexpansion | 2 setlocal enabledelayedexpansion |
| 6 set "time=0" | 3 set "time=0" |
| 7 | 4 |
| 8 REM - folder checks | 5 if [%1] == [] echo usage: %0 ^<video^> |
| 9 :question | 6 if not exist %1 echo usage: %0 ^<video^> |
| 10 if not exist "%~n1" goto start | 7 |
| 8 :foldercheck | |
| 9 if not exist "%~n1" goto encode | |
| 11 set /p "answer=The folder '%~n1' already exists. Would you like to overwrite or merge the contents? [o/m]: " | 10 set /p "answer=The folder '%~n1' already exists. Would you like to overwrite or merge the contents? [o/m]: " |
| 12 if "%answer%" == "o" ( | 11 if "%answer%" == "o" ( |
| 13 del /f /s /q "%~n1" | 12 del /f /s /q "%~n1" |
| 14 goto start | 13 goto encode |
| 15 ) | 14 ) |
| 16 if "%answer%" == "m" goto start | 15 if "%answer%" == "m" goto encode |
| 17 goto question | 16 goto foldercheck |
| 18 | 17 |
| 19 REM - | 18 :encode |
| 20 :start | |
| 21 if not exist "%~n1" mkdir "%~n1" | 19 if not exist "%~n1" mkdir "%~n1" |
| 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 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" |
| 23 for /F "tokens=*" %%F in ("%~n1\gif_%time%.gif") do set "size=%%~zF" | 21 for /F "tokens=*" %%F in ("%~n1\gif_%time%.gif") do set "size=%%~zF" |
| 24 if "!size!" == "0" ( | 22 if "!size!" == "0" ( |
| 25 del "%~n1\gif_%time%.gif" | 23 del "%~n1\gif_%time%.gif" |
| 26 exit /B | 24 exit /B |
| 27 ) | 25 ) |
| 28 set /a "time=%time%+5" | 26 set /a "time=%time%+5" |
| 29 goto start | 27 goto encode |
