From a00d5ae4dad5f35c5bc117375568909e3ee32068 Mon Sep 17 00:00:00 2001 From: Michael SCHAL Date: Thu, 1 Jan 2026 23:19:48 +0100 Subject: [PATCH] Force GPU transcoding (h264_nvenc) for Live TV when GPU toggle is enabled --- bin/api/streaming_handler.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/api/streaming_handler.dart b/bin/api/streaming_handler.dart index 5154e4c..895af4c 100644 --- a/bin/api/streaming_handler.dart +++ b/bin/api/streaming_handler.dart @@ -194,15 +194,22 @@ Handler createLiveStreamHandler( // Output encoding options if (useNvidiaGpu) { - // With GPU: Use NVENC for any re-encoding needed + // With GPU: Transcode using NVIDIA NVENC for hardware acceleration + print('[Live] Transcoding video with h264_nvenc (GPU)'); ffmpegArgs.addAll([ - '-c:v', 'copy', // Still copy video (no transcode needed for live) + '-c:v', 'h264_nvenc', // Use NVIDIA NVENC encoder + '-preset', 'p4', // Good quality/speed balance (p1=fastest, p7=best) + '-tune', 'll', // Low latency tuning for live streams + '-rc', 'vbr', // Variable bitrate + '-cq', '23', // Quality level (similar to CRF) + '-maxrate', '6000k', // Max bitrate for live + '-bufsize', '12000k', // Buffer size '-c:a', 'aac', // Audio to AAC (browser compatible) '-b:a', '192k', '-ac', '2', ]); } else { - // Without GPU: Standard CPU processing + // Without GPU: Standard CPU processing (copy video) ffmpegArgs.addAll([ '-c:v', 'copy', // Video: Direct copy (Very low CPU) '-c:a', 'aac', // Audio: Transcode to AAC