Advertisement
zetlnd

Untitled

Nov 19th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. @echo off
  2. chcp 65001 > nul
  3. setlocal enabledelayedexpansion
  4.  
  5. rem Get the FFmpeg path
  6. set "FFMPEG_PATH=%~dp0ffmpeg.exe"
  7. if not exist "!FFMPEG_PATH!" (
  8. echo FFmpeg не найден. Скачивание...
  9. powershell -Command "& { (New-Object System.Net.WebClient).DownloadFile('https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip', '%~dp0ffmpeg.zip') }"
  10. if not exist "%~dp0ffmpeg.zip" (
  11. echo Не удалось скачать FFmpeg.
  12. pause
  13. exit /b
  14. )
  15. powershell -Command "& { Expand-Archive -Path '%~dp0ffmpeg.zip' -DestinationPath '%~dp0' }"
  16. del "%~dp0ffmpeg.zip"
  17. for /d %%D in ("%~dp0ffmpeg*") do move "%%D\bin\ffmpeg.exe" "%~dp0ffmpeg.exe" && rd /s /q "%%D"
  18. if not exist "!FFMPEG_PATH!" (
  19. echo FFmpeg не удалось извлечь.
  20. pause
  21. exit /b
  22. )
  23. )
  24.  
  25. rem Check if files were dragged
  26. if "%~1"=="" (
  27. echo Перетащите файлы MP4 на скрипт для конвертации.
  28. pause
  29. exit /b
  30. )
  31.  
  32. rem Create output folder
  33. set "OUTPUT_FOLDER=%~dp0output"
  34. if not exist "!OUTPUT_FOLDER!" mkdir "!OUTPUT_FOLDER!"
  35.  
  36. rem Process each dragged file
  37. :loop
  38. if "%~1"=="" goto end
  39. set "INPUT_FILE=%~1"
  40. set "FILENAME=%~n1"
  41. "!FFMPEG_PATH!" -i "!INPUT_FILE!" "!OUTPUT_FOLDER!\!FILENAME!.gif"
  42. shift
  43. goto loop
  44.  
  45. :end
  46. echo Конвертация завершена!
  47. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement