@echo off
rem Полный рендер 30 с: 4 процесса Chrome по 450 кадров, потом склейка без перекодирования.
cd /d E:\PKSTUDIO\clients\pk_motion
if not exist out\seg mkdir out\seg
del /q out\seg\*.mp4 2>nul
start "p0" /b cmd /c "node tools\pm_capture.mjs --page web\index.html --out out\seg\s0.mp4 --from 0 --to 450 --port 9340 > out\seg\l0.txt 2>&1"
start "p1" /b cmd /c "node tools\pm_capture.mjs --page web\index.html --out out\seg\s1.mp4 --from 450 --to 900 --port 9341 > out\seg\l1.txt 2>&1"
start "p2" /b cmd /c "node tools\pm_capture.mjs --page web\index.html --out out\seg\s2.mp4 --from 900 --to 1350 --port 9342 > out\seg\l2.txt 2>&1"
node tools\pm_capture.mjs --page web\index.html --out out\seg\s3.mp4 --from 1350 --to 1800 --port 9343 > out\seg\l3.txt 2>&1
:wait
timeout /t 5 /nobreak >nul
for %%i in (0 1 2) do findstr /c:"frames_done" out\seg\l%%i.txt >nul || goto wait
(echo file 's0.mp4'& echo file 's1.mp4'& echo file 's2.mp4'& echo file 's3.mp4') > out\seg\list.txt
C:\Users\PKSTUDIO\.cache\hyperframes\ffmpeg\ffmpeg-9.0.1-essentials_build\bin\ffmpeg.exe -v error -y -f concat -safe 0 -i out\seg\list.txt -c copy out\pk_motion_video.mp4
echo RENDER_DONE
