fix: wait for mediamtx port 8554 before starting ffmpeg
This commit is contained in:
parent
0207593975
commit
4ad664ecc5
@ -73,6 +73,15 @@ function Invoke-Start {
|
||||
# 1. RTSP server
|
||||
Write-Banner "1/5 RTSP Server (mediamtx)"
|
||||
Start-Detached "mediamtx" $mediamtx
|
||||
Write-Host " [WAIT] 等待 RTSP 服务就绪..." -ForegroundColor DarkGray
|
||||
$ready = $false
|
||||
for ($i = 0; $i -lt 10; $i++) {
|
||||
Start-Sleep 1
|
||||
$tcp = netstat -an 2>$null | Select-String ':8554.*LISTENING'
|
||||
if ($tcp) { $ready = $true; break }
|
||||
}
|
||||
if ($ready) { Write-Host " [OK] RTSP 服务就绪" -ForegroundColor Green }
|
||||
else { Write-Host " [WARN] RTSP 服务可能未就绪" -ForegroundColor Yellow }
|
||||
|
||||
# 2. ffmpeg push
|
||||
Write-Banner "2/5 RTSP 推流 (ffmpeg)"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user