Files
SDI-bridge/worker.cmd

44 lines
1.2 KiB
Batchfile

@echo off
REM ============================================================
REM Generic SDI worker
REM Usage: worker.cmd <channel_number> <rtsp_url> <card_name>
REM Example: worker.cmd 1 rtsp://10.10.5.140:8554/live1 "DeckLink Duo"
REM ============================================================
setlocal
set "CHANNEL=%~1"
set "URL=%~2"
set "CARD=%~3"
if "%CARD%"=="" set "CARD=DeckLink Quad"
set "FFMPEG=C:\sdi-bridge\ffmpeg.exe"
set "STOPFLAG=C:\sdi-bridge\STOP.flag"
set "DECKLINK=%CARD% (%CHANNEL%)"
title SDI-%CHANNEL% ^| %URL%
:loop
if exist "%STOPFLAG%" (
echo [%date% %time%] Stop flag detected. Exiting worker.
exit /b 0
)
echo [%date% %time%] Starting : %DECKLINK%
echo [%date% %time%] Stream : %URL%
"%FFMPEG%" ^
-rtsp_transport tcp -timeout 5 -fflags nobuffer ^
-i "%URL%" ^
-map 0:v:0 -an -duplex_mode half ^
-vf "scale=1920:1080:flags=fast_bilinear,format=uyvy422,setfield=tff" ^
-f decklink -pix_fmt uyvy422 -format_code Hi50 ^
"%DECKLINK%"
if exist "%STOPFLAG%" (
echo [%date% %time%] Stop flag detected. Exiting worker.
exit /b 0
)
echo [%date% %time%] Stream stopped. Restarting in 3 sec...
timeout /t 3 /nobreak >nul
goto loop