Last active
May 17, 2024 14:36
-
-
Save wincmd64/bf2d84fbcc847b8db701bb8d9ed06dfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: ПАКЕТНАЯ КОНВЕРТАЦИЯ ВИДЕОФАЙЛОВ С ПОМОЩЬЮ ПРЕСЕТОВ HANDBRAKE | |
:: by https://t.me/wincmd64 | |
:: ИСПОЛЬЗОВАНИЕ: | |
:: 1. создать ярлык на этот .bat-файл в папке Shell:SendTo (либо кнопкой в TotalCmd с параметром %P%S) | |
:: 2. выделить нужные видеофайлы и выбрать в контекстном меню пункт Отправить > *имя_ярлыка* | |
:: 3. ввести нужное название пресета из https://handbrake.fr/docs/en/1.6.0/technical/official-presets.html | |
:: HandBrakeCLI.exe должен быть в PATH (winget install HandBrake.HandBrake.CLI) | |
:: либо рядом с .bat (https://handbrake.fr/downloads2.php) | |
@echo off | |
:: get HandBrakeCLI.exe path | |
for /f "tokens=* delims=" %%a in ('where HandBrakeCLI.exe') do set "app=%%a" | |
if not exist "%app%" ( | |
pause | |
exit | |
) | |
TITLE %app% | |
:: checking the number of selected files | |
set count=0 | |
for %%A in (%*) do set /a count+=1 | |
if %count% equ 1 ( | |
echo 1 file selected: %* | |
) else ( | |
echo %count% files selected | |
) | |
SET /p preset=Enter HandBrake preset name or press Enter for default preset (Fast 1080p30): | |
if "%preset%"=="" ( | |
SET preset=Fast 1080p30 | |
) | |
TITLE %preset% | |
FOR %%k IN (%*) DO ( | |
echo. | |
echo FILE: %%k [%%~tk] | |
"%app%" -v0 -Z "%preset%" -E copy -i "%%~k" -o "%%~dpnk_%preset%.mp4" | |
FOR /f "tokens=1-5 delims=.-/: " %%m IN ("%%~tk") DO ( | |
powershell "Get-ChildItem '%%~dpnk_%preset%.mp4' | ForEach-Object{$_.CreationTime = $_.LastWriteTime = $_.LastAccessTime = New-Object DateTime %%o,%%n,%%m,%%p,%%q,00}" | |
) | |
) | |
color 27 | |
timeout 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment