mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-19 13:08:05 +02:00
Fix GPU Live TV rollbacks - add vsync cfr, async, smaller buffer, faster keyframes
This commit is contained in:
1 parent
f6d5ae7764
commit
8670e42cf8
1 file changed
+9
-3
@@ -199,19 +199,25 @@ Handler createLiveStreamHandler(
|
|||||||
// With GPU: Transcode using NVIDIA NVENC for hardware acceleration
|
// With GPU: Transcode using NVIDIA NVENC for hardware acceleration
|
||||||
print('[Live] Transcoding video with h264_nvenc (GPU)');
|
print('[Live] Transcoding video with h264_nvenc (GPU)');
|
||||||
ffmpegArgs.addAll([
|
ffmpegArgs.addAll([
|
||||||
|
// Video encoding
|
||||||
'-c:v', 'h264_nvenc', // Use NVIDIA NVENC encoder
|
'-c:v', 'h264_nvenc', // Use NVIDIA NVENC encoder
|
||||||
'-preset', 'p1', // Fastest preset for live (p1=fastest)
|
'-preset', 'p1', // Fastest preset for live (p1=fastest)
|
||||||
'-tune', 'll', // Low latency tuning for live streams
|
'-tune', 'll', // Low latency tuning for live streams
|
||||||
'-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', '8000k', // Buffer size (2x bitrate)
|
'-bufsize', '4000k', // Smaller buffer for lower latency
|
||||||
'-g', '50', // Keyframe interval (every 2 seconds at 25fps)
|
'-g', '25', // Keyframe every 1 second (at 25fps)
|
||||||
'-bf', '0', // No B-frames for lower latency
|
'-bf', '0', // No B-frames for lower latency
|
||||||
|
// Audio encoding
|
||||||
'-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', '44100', // Audio sample rate
|
'-ar', '48000', // 48kHz sample rate (matches most sources)
|
||||||
|
// Sync options to prevent rollbacks
|
||||||
|
'-vsync', 'cfr', // Constant frame rate
|
||||||
|
'-async', '1', // Sync audio to video timestamps
|
||||||
|
'-max_muxing_queue_size', '1024', // Bigger 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