GISTS/windows/video scripts/convertion-av1.bat

85 lignes
2,8 Kio
Batchfile
Brut Vue normale Historique

2024-09-28 02:18:46 +02:00
@echo off
chcp 65001 >nul
set binpath=%~dp0
set "gstart=%date% - %time%"
if not exist "%binpath%\ffmpeg.exe" echo ffmpeg not found. exiting... & echo. & pause & exit 1
cmd.exe /c tasklist /FI "IMAGENAME eq ProcessTamerTray.exe" | find /I /N "ProcessTamerTray.exe" ||start "" "%binpath%ProcessTamerPortable64\ProcessTamerTray.exe"
:do
if [%1]==[] goto noarg
%~d1
if exist %1\* (
cd %1
) else (
cd "%~dp1"
)
IF %ERRORLEVEL% NEQ 0 (echo %1 & pause)
if not exist "ok\" mkdir ok
IF %ERRORLEVEL% NEQ 0 pause
if not exist "orig\" mkdir orig
IF %ERRORLEVEL% NEQ 0 pause
if exist %1\* (
setlocal EnableDelayedExpansion
for /f "delims=" %%a in ('dir /b *.mkv *.avi *.mp4') do (
title ffmpeg: %%~na
set "istart=%date% - %time%"
"%binpath%\ffmpeg.exe" -hide_banner -hwaccel_output_format cuda -i "%%~dpnxa" -c:v libsvtav1 -preset 6 -tune animation -crf 30 -c:s copy -map 0 -map -v -map V "%%~dpa\ok\%%~na - AV1 [AlbiRip].mkv"
IF !ERRORLEVEL! NEQ 0 (
echo ######################################
echo ## %%~na ERREUR !!! ##
echo ######################################
del "%%~dpa\ok\%%~na AV1 [AlbiRip].mkv"
) else (
move "%%a" orig\
echo _______________________________________
echo %%~na OK
echo ITEM START TIME: %istart%
echo ITEM END TIME : %date% - %time%
echo _______________________________________
)
"%binpath%\sounder.exe" /vol 25 "%binpath%\Infobulle.wav"
)
) else (
title ffmpeg: %~n1
set "istart=%date% - %time%"
"%binpath%\ffmpeg.exe" -hide_banner -hwaccel_output_format cuda -i %1 -c:v libsvtav1 -preset 6 -tune animation -crf 30 -c:s copy -map 0 -map -v -map V "ok\%~n1 - AV1 [AlbiRip].mkv"
if %ERRORLEVEL% NEQ 0 (
echo ######################################
echo ## %~n1 ERREUR !!! ##
echo ######################################
del "ok\%~n1 - AV1 [AlbiRip].mkv"
) else (
move "%~nx1" "orig\"
echo _______________________________________
echo %%~n1 OK
echo ITEM START TIME: %istart%
echo ITEM END TIME : %date% - %time%
echo _______________________________________
)
)
"%binpath%\sounder.exe" /vol 25 "%binpath%\Infobulle.wav"
shift /1
if [%1] NEQ [] goto do
::alert, use a wav file with CLI player from https://elifulkerson.com/projects/commandline-wav-player.php
"%binpath%\sounder.exe" /vol 25 "%binpath%\alert.wav"
taskkill /im ProcessTamerTray.exe
echo.
echo.
echo GLOBAL START TIME: %gstart%
echo GLOBAL END TIME : %date% - %time%
echo.
echo.
::timeout 300
pause
exit 0
:: presets: 1_ultrafast, 6_medium, 9_veryslow
:: crf: exponential, 0 is lossless, 23 is the default, and 51 is worst quality possible
:noarg
echo Convert videos or videos inside folders to AV1 format
echo Usage: %~nx0 "video1.flv" "video2.mp4" "video_folder"
echo.
pause
exit 0