mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-22 22:48:04 +02:00
Fix GPU rollbacks v2 - aresample filter, copyts, larger buffers
This commit is contained in:
1 parent
d93d638b1b
commit
33a331dce9
1 file changed
+10
-8
@@ -206,18 +206,20 @@ Handler createLiveStreamHandler(
|
|||||||
'-rc', 'cbr', // Constant bitrate for stable streaming
|
'-rc', 'cbr', // Constant bitrate for stable streaming
|
||||||
'-b:v', '4000k', // Fixed video bitrate
|
'-b:v', '4000k', // Fixed video bitrate
|
||||||
'-maxrate', '4500k', // Max bitrate
|
'-maxrate', '4500k', // Max bitrate
|
||||||
'-bufsize', '4000k', // Smaller buffer for lower latency
|
'-bufsize', '8000k', // Buffer for stability
|
||||||
'-g', '25', // Keyframe every 1 second (at 25fps)
|
'-g', '50', // Keyframe every 2 seconds (at 25fps)
|
||||||
'-bf', '0', // No B-frames for lower latency
|
'-bf', '0', // No B-frames for lower latency
|
||||||
// Audio encoding
|
// Audio encoding with resampling to fix timestamp gaps
|
||||||
|
'-af',
|
||||||
|
'aresample=async=1000:first_pts=0', // Auto-correct audio timestamps
|
||||||
'-c:a', 'aac', // Audio to AAC (browser compatible)
|
'-c:a', 'aac', // Audio to AAC (browser compatible)
|
||||||
'-b:a', '128k', // Audio bitrate
|
'-b:a', '128k', // Audio bitrate
|
||||||
'-ac', '2',
|
'-ac', '2',
|
||||||
'-ar', '48000', // 48kHz sample rate (matches most sources)
|
'-ar', '48000', // 48kHz sample rate
|
||||||
// Sync options to prevent rollbacks
|
// Timestamp handling
|
||||||
'-vsync', 'cfr', // Constant frame rate
|
'-copyts', // Copy timestamps
|
||||||
'-async', '1', // Sync audio to video timestamps
|
'-start_at_zero', // Start at 0
|
||||||
'-max_muxing_queue_size', '1024', // Bigger muxing queue
|
'-max_muxing_queue_size', '4096', // Large muxing queue
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Without GPU: Standard CPU processing (copy video)
|
// Without GPU: Standard CPU processing (copy video)
|
||||||
|
|||||||
Reference in new issue
Block a user