SHARE
TWEET

Untitled

a guest Aug 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. 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
  4. REM WARNING: Rember to set the path for ffmpeg.exe if yours is different
  5. REM WARNING: Set output path to one that exists on your system
  6.  
  7. REM CHANGELOG:
  8. REM *Seperated palette variables from gif render variables and move "@echo off" to the first line
  9.  
  10. set CLIP_PATH=%1
  11. set /p START_TIME="Enter start time: "
  12. set /p DURATION="Enter duration: "
  13. set FPS=20
  14. set SCALE=640
  15.  
  16. ======================================================================================================================================================================================================================================================================
  17.  
  18. set PALETTE_START_TIME=%START_TIME%
  19. set PALETTE_DURATION=%DURATION%
  20. set PALETTE_FPS=%FPS%
  21. set PALETTE_SCALE=%SCALE%
  22.  
  23. set ID=%RANDOM%
  24. set PALETTE_PATH=%tmp%palette%ID%.png
  25. set OUTPUT_PATH="F:\Downloads\output%ID%.gif"
  26. set FFMPEG_PATH="C:\youtube-dl\ffmpeg.exe"
  27.  
  28. %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%
  29.  
  30. %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%
  31.  
  32. del %PALETTE_PATH%
  33.  
  34. echo.
  35. echo created gif at %OUTPUT_PATH%
  36. echo.
  37. pause
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top