28.12.2025, 20:19
I would like to execute a .bat file after the queue completes. I tried to just supply the path to the .bat file, but that did not work.
Quote:I would like to execute a .bat file after the queue completes.Did set "On queue finished:" to "call external at queue finished external call" ? Or did you just set the file?

@echo off
echo Hello World!>F:\test.txtSuccessfully called: "c:\Users\Selur\Desktop\test.bat"@echo off
setlocal EnableExtensions EnableDelayedExpansion
set "WORKDIR=F:\SBP\RESIZE"
set "LOG=F:\SBP\SCRIPTS\hybrid_queue_done.log"
set "LOCKDIR=%TEMP%\hybrid_queue_done.lockdir"
REM Prevent overlapping runs
mkdir "%LOCKDIR%" 2>nul
if errorlevel 1 (
echo Another run is already active. Exiting.
>>"%LOG%" echo [%date% %time%] Another run already active; exiting.
exit /b 0
)
REM Log header (this does NOT hide console output)
>>"%LOG%" echo.
>>"%LOG%" echo ===== %date% %time% =====
>>"%LOG%" echo User=%USERNAME%
>>"%LOG%" echo WorkingDir=%CD%
pushd "%WORKDIR%" || (
echo ERROR: cannot cd to "%WORKDIR%"
>>"%LOG%" echo ERROR: cannot cd to "%WORKDIR%"
rmdir "%LOCKDIR%" 2>nul
exit /b 1
)
echo Running post-queue script in: %CD%
echo (This window will show ffmpeg progress. Closing it will stop the encode.)
REM IMPORTANT: no redirection here, so you see live progress
call "F:\SBP\RESIZE\PostQ - Ladder - x265 SBP Tuned - CRF22 Slow - Full Color 10bit BT709 - Encode Aud.bat" nopause
set "EC=%errorlevel%"
echo Encode finished. ExitCode=%EC%
>>"%LOG%" echo ExitCode=%EC%
popd
rmdir "%LOCKDIR%" 2>nul
exit /b %EC%@echo off
setlocal EnableExtensions EnableDelayedExpansion
REM Run from your working folder
pushd "F:\SBP\RESIZE" || exit /b 1
REM Prevent overlapping runs (Hybrid hook can fire twice)
set "LOCK=%TEMP%\hybrid_encode.lock"
if exist "%LOCK%" exit /b 0
> "%LOCK%" echo %DATE% %TIME%
REM Ensure output folder exists
if not exist "F:\SBP\NAME" mkdir "F:\SBP\NAME" >nul 2>&1
for %%f in (*.mp4 *.mov *.mxf *.mkv) do (
if exist "%%f" call :processOne "%%f"
)
del "%LOCK%" 2>nul
popd
REM Only pause when run manually (no args)
if "%~1"=="" pause
exit /b 0
:processOne
set "source_file=%~1"
set "source_name=%~n1"
set "source_height="
set "acodec="
set "AOPTS=-c:a copy"
REM ---- Get source height ----
for /f "usebackq delims=" %%h in (`
ffprobe -v error -select_streams v:0 -show_entries stream^=height -of default^=noprint_wrappers^=1:nokey^=1 "%source_file%"
`) do set "source_height=%%h"
REM Validate numeric height; skip if ffprobe failed
for /f "delims=0123456789" %%x in ("!source_height!") do set "source_height="
if not defined source_height exit /b 0
REM ---- Get audio codec (if any) ----
for /f "usebackq delims=" %%a in (`
ffprobe -v error -select_streams a:0 -show_entries stream^=codec_name -of default^=noprint_wrappers^=1:nokey^=1 "%source_file%"
`) do set "acodec=%%a"
REM If PCM audio, encode to AAC 192k; otherwise copy
if defined acodec (
if /i "!acodec:~0,4!"=="pcm_" set "AOPTS=-c:a aac -b:a 192k"
)
REM ---- Encode ladder (only rungs <= source height) ----
for %%r in (2160 1440 1080 720) do (
if !source_height! GEQ %%r (
set "OUT=F:\SBP\NAME\!source_name! - %%r.mp4"
ffmpeg -y -nostdin -flush_packets 1 -i "%source_file%" ^
-map 0:v:0 -map 0:a:0? ^
-vf "scale=w=-1:h=%%r:flags=lanczos+accurate_rnd+full_chroma_int,zscale=matrix=709:transfer=709:primaries=709:range=full,format=yuv420p10le" ^
-c:v libx265 -profile:v main10 -preset slow -crf 22 ^
-x265-params "asm=avx512:pme=0:pmode=0:aq-strength=1.1:psy-rdoq=1.7:psy-rd=3.00:rd=4:ssim-rd=1:wpp=1:crqpoffs=-3:rect=0:ctu=32:rc-lookahead=60:subme=4:merange=32:min-cu-size=8:max-tu-size=32:tu-inter-depth=2:tu-intra-depth=2:qcomp=0.65:selective-sao=0:no-sao=1:early-skip=0:fast-intra=1:bframes=5:strong-intra-smoothing=0:keyint=300:min-keyint=28:aq-mode=3:rskip=2:deblock=-2,-2" ^
!AOPTS! ^
-movflags +faststart "!OUT!"
if errorlevel 1 del /q "!OUT!" 2>nul
)
)
exit /b 0