Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM USAGE: Drag and drop a video file (tested on mp4 but any format supported by ffmpeg should work) onto the bat file and follow the prompts shown in cmd
- REM WARNING: Rember to set the path for ffmpeg.exe if yours is different
- REM WARNING: Set output path to one that exists on your system
- REM CHANGELOG:
- REM *Seperated palette variables from gif render variables and move "@echo off" to the first line
- set CLIP_PATH=%1
- set /p START_TIME="Enter start time: "
- set /p DURATION="Enter duration: "
- set FPS=20
- set SCALE=640
- ======================================================================================================================================================================================================================================================================
- set PALETTE_START_TIME=%START_TIME%
- set PALETTE_DURATION=%DURATION%
- set PALETTE_FPS=%FPS%
- set PALETTE_SCALE=%SCALE%
- set ID=%RANDOM%
- set PALETTE_PATH=%tmp%palette%ID%.png
- set OUTPUT_PATH="F:\Downloads\output%ID%.gif"
- set FFMPEG_PATH="C:\youtube-dl\ffmpeg.exe"
- %FFMPEG_PATH% -y -ss %PALETTE_START_TIME% -t %PALETTE_DURATION% -i %CLIP_PATH% -vf fps=%PALETTE_FPS%,scale=%PALETTE_SCALE%:-1:flags=lanczos,palettegen %PALETTE_PATH%
- %FFMPEG_PATH% -ss %START_TIME% -t %DURATION% -i %CLIP_PATH% -i %PALETTE_PATH% -filter_complex "fps=%FPS%,scale=%SCALE%:-1:flags=lanczos[x];[x][1:v]paletteuse" %OUTPUT_PATH%
- del %PALETTE_PATH%
- echo.
- echo created gif at %OUTPUT_PATH%
- echo.
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement