updated video scripts

Cette révision appartient à :
Albirew 2024-06-12 19:44:14 +02:00
Parent 4c7efb92f1
révision 51aa6e6583
Signé par: Albirew
ID de la clé GPG: 9D72DAEB1BB933C9
14 fichiers modifiés avec 178 ajouts et 49 suppressions

Fichier binaire non affiché.

Voir le fichier

@ -0,0 +1,13 @@
# COLLECTION OF DOWNLOADING AND TRANSCODING SCRIPTS
### You'll need:
* ffmpeg
* to use with convertion scripts
* yt-dlp
* To use with youtube-dl scripts
### You may also want:
* [sounder](https://www.elifulkerson.com/projects/commandline-wav-player.php)
* A little executable to play a sound file when one or all files has been processed
* [ProcessTamerPortable64](https://www.donationcoder.com/software/mouser/popular-apps/process-tamer)
* Control ffmpeg priority so you can still use your computer when encoding AV1 videos

BIN
windows/video scripts/alert.wav Fichier normal

Fichier binaire non affiché.

Voir le fichier

@ -0,0 +1,60 @@
@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
echo GLOBAL START TIME: %gstart%
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
cd %1
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
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"
)
shift /1
if [%1] NEQ [] goto do
taskkill /im ProcessTamerTray.exe
::alert, use a wav file with CLI player from https://elifulkerson.com/projects/commandline-wav-player.php
"%binpath%\sounder.exe" "%binpath%\alert.wav"
echo.
echo.
echo GLOBAL START TIME: %gstart%
echo GLOBAL END TIME : %date% - %time%
echo.
echo.
::timeout 300
:: veille
::rundll32.exe powrprof.dll,SetSuspendState 1,0,1
:: veille prolongée
::rundll32.exe powrprof.dll,SetSuspendState 0,1,0
pause
exit 0
:noarg
echo Usage: %~nx0 "folder containig videos to convert"
echo.
pause
exit

Voir le fichier

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# UNTESTED since av1 encoding on my linux boxes is slow as hell
cd "$1"
mkdir ok
mkdir orig
for i in *.avi *.mkv *.mp4
do
# libaom-av1 libsvtav1
[ -f "${i}" ] && ffmpeg -hide_banner -i "./${i}" -c:v libsvtav1 -preset 6 -crf 30 -map 0 "./ok/${i%.*}[AlbiRip AV1].mkv"
mv "${i}" orig/
done

Voir le fichier

@ -0,0 +1,49 @@
@echo off
chcp 65001 >nul
set binpath=%~dp0
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
cd "%~dp1"
if not exist "ok\" mkdir ok
if not exist "orig\" mkdir orig
title ffmpeg: %~n1
echo vid: %1
echo start libsvtav1 %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 (
echo stop: %date% %time%
move "%~nx1" "orig\"
echo _______________________________________
echo %~n1 OK
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" "%binpath%\alert.wav"
taskkill /im ProcessTamerTray.exe
::timeout 300
:: veille
::rundll32.exe powrprof.dll,SetSuspendState 1,0,1
:: veille prolongée
::rundll32.exe powrprof.dll,SetSuspendState 0,1,0
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 Usage: %~nx0 "video to convert.flv"
echo.
pause
exit 0

Voir le fichier

@ -3,12 +3,12 @@ set binpath=%~dp0
if not exist "%binpath%\ffmpeg.exe" echo ffmpeg not found. exiting... & echo. & pause & exit 1
:do
if [%1]==[] goto noarg
"%binpath%\ffmpeg.exe" -i %1 -c:v libsvtav1 -preset 6 -crf 30 "%~dpn1[AV1].mkv"
::"%binpath%\ffmpeg.exe" -i %1 -c:v libaom-av1 -preset 2 -crf 30 "%~dpn1[AV1].mkv"
"%binpath%\ffmpeg.exe" -hwaccel cuda -hwaccel_output_format cuda -i %1 -c:v hevc_nvenc "%~dpn1[HEVC].mkv"
"%binpath%\ffmpeg.exe" -hwaccel cuda -hwaccel_output_format cuda -i %1 -c:v hevc_nvenc -map 0 "%~dpn1[HEVC].mkv"
IF %ERRORLEVEL% NEQ 0 pause
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" "%binpath%\alert.wav"
exit 0
:noarg

Voir le fichier

@ -0,0 +1,36 @@
@echo off
chcp 65001 >nul
echo @echo off >0-conv.bat
set binpath=%~dp0
if not exist "%binpath%\ffmpeg.exe" echo ffmpeg not found. exiting... & echo. & pause & exit 1
echo cmd.exe /c tasklist /FI "IMAGENAME eq ProcessTamerTray.exe" ^| find /I /N "ProcessTamerTray.exe" ^|^|start "" "%binpath%ProcessTamerPortable64\ProcessTamerTray.exe" >>0-conv.bat
echo %~d1 >>0-conv.bat
echo cd %~dp1 >>0-conv.bat
:do
if [%1]==[] goto noarg
echo if not exist "ok\" mkdir ok >>0-conv.bat
echo if not exist "orig\" mkdir orig >>0-conv.bat
echo "%binpath%\ffmpeg.exe" -hide_banner -hwaccel_output_format cuda -i "%~nx1" -c:v libsvtav1 -preset 6 -crf 30 -c:s copy -map 0 -map -v -map V "ok\%~n1 AV1 [AlbiRip].mkv" >>0-conv.bat
echo if %%ERRORLEVEL%% NEQ 0 ( >>0-conv.bat
echo del "ok\%~n1 AV1 [AlbiRip].mkv" >>0-conv.bat
echo ) else ( >>0-conv.bat
echo move "%~nx1" "orig\" >>0-conv.bat
echo ) >>0-conv.bat
echo "%binpath%\sounder.exe" /vol 25 "%binpath%\Infobulle.wav" >>0-conv.bat
shift /1
if [%1] NEQ [] goto do
echo "%binpath%\sounder.exe" "%binpath%\alert.wav" >>0-conv.bat
echo taskkill /im ProcessTamerTray.exe >>0-conv.bat >>0-conv.bat
echo pause >>0-conv.bat
echo OK
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 Usage: %~nx0 "video to convert.flv"
echo.
pause
exit 0

Voir le fichier

@ -9,6 +9,6 @@ echo.
set /P command=Enter options and video URL:
if ["%command%"] == [""] exit 0
echo.
echo $^>yt-dlp -x -k -f b --audio-format mp3 --write-sub --sub-lang fr,en --yes-playlist --geo-bypass %command%
"%binpath%\yt-dlp.exe" -x -k -f b --audio-format mp3 --write-sub --sub-lang fr,en --yes-playlist --geo-bypass %command%
echo $^>yt-dlp -x -k -f b --audio-format mp3 --write-sub --sub-lang fr,en --yes-playlist --geo-bypass "%command%"
"%binpath%\yt-dlp.exe" -x -k -f b --audio-format mp3 --write-sub --sub-lang fr,en --yes-playlist --geo-bypass "%command%"
IF %ERRORLEVEL% NEQ 0 pause

Voir le fichier

@ -9,6 +9,6 @@ echo.
set /P command=Enter options and video URL:
if ["%command%"] == [""] exit 0
echo.
echo $^>yt-dlp --extract-audio --audio-format mp3 --geo-bypass %command%
"%binpath%\yt-dlp.exe" --extract-audio --audio-format mp3 --geo-bypass %command%
echo $^>yt-dlp --extract-audio --audio-format mp3 --geo-bypass "%command%"
"%binpath%\yt-dlp.exe" --extract-audio --audio-format mp3 --geo-bypass "%command%"
IF %ERRORLEVEL% NEQ 0 pause

Voir le fichier

@ -1,26 +0,0 @@
@echo off
set binpath=%~dp0
if not exist "%binpath%\ffmpeg.exe" echo ffmpeg not found. exiting... & echo. & pause & exit 1
:do
if [%1]==[] goto noarg
cd %1
for /f "delims=" %%a in ('dir /b *.mkv *.avi *.mp4') do (
:: speed 0.6x
"%binpath%\ffmpeg.exe" -hwaccel_output_format cuda -i "%%a" -c:v libsvtav1 -preset 6 -crf 30 "%%~dpna[AV1].mkv"
IF %ERRORLEVEL% NEQ 0 pause
:: speed 0.1x
:: "%binpath%\ffmpeg.exe" -hwaccel_output_format cuda -i "%%a" -c:v libaom-av1 -preset 2 -crf 30 "%%~dpna[AV1].mkv"
:: IF %ERRORLEVEL% NEQ 0 pause
:: "%binpath%\ffmpeg.exe" -hwaccel cuda -hwaccel_output_format cuda -i "%%a" -c:v hevc_nvenc "%%~dpna[HEVC].mkv"
:: IF %ERRORLEVEL% NEQ 0 pause
echo %%a OK
)
shift /1
if [%1] NEQ [] goto do
exit 0
:noarg
echo Usage: %~nx0 "folder containig videos to convert"
echo.
pause
exit

Voir le fichier

@ -1,16 +0,0 @@
@echo off
set binpath=%~dp0
if not exist "%binpath%\ffmpeg.exe" echo ffmpeg not found. exiting... & echo. & pause & exit 1
:do
if [%1]==[] goto noarg
"%binpath%\ffmpeg.exe" -i %1 "%~dpn1.mp4"
IF %ERRORLEVEL% NEQ 0 pause
shift /1
if [%1] NEQ [] goto do
exit 0
:noarg
echo Usage: %~nx0 "video to convert.flv"
echo.
pause
exit