Implement WebRTC URL resolution and update stream playback logic across components and API routes

This commit is contained in:
Nikita
2025-12-23 11:32:08 -08:00
parent f45c28f941
commit 93bd99f9ed
10 changed files with 133 additions and 30 deletions

View File

@@ -22,7 +22,7 @@ if [ -z "$STREAM_KEY" ]; then
fi
exec ffmpeg -f avfoundation -capture_cursor 1 -framerate 60 -i "2:1" \
-c:v h264_videotoolbox -b:v 30000k -maxrate 45000k -bufsize 90000k \
-c:v h264_videotoolbox -b:v 50000k -maxrate 100000k -bufsize 200000k \
-profile:v high -pix_fmt yuv420p \
-g 120 -keyint_min 120 \
-c:a aac -b:a 256k -ar 48000 -ac 2 \

View File

@@ -388,13 +388,13 @@ class HardwareEncoder {
let baseWidth = 2560
let baseHeight = 1440
let baseFrameRate = 60
let baseBitrate = 30_000_000
let baseBitrate = 50_000_000
let pixels = max(1, width) * max(1, height)
let basePixels = baseWidth * baseHeight
let fpsScale = Double(max(frameRate, 1)) / Double(baseFrameRate)
let raw = Double(baseBitrate) * (Double(pixels) / Double(basePixels)) * fpsScale
return min(max(Int(raw.rounded()), 12_000_000), 80_000_000)
return min(max(Int(raw.rounded()), 12_000_000), 120_000_000)
}
deinit {