Fix VOD GPU transcoding - remove hwaccel_output_format, use CBR mode for HLS

This commit is contained in:
Michael committed 2026-01-01 23:33:02 +01:00
1 parent cd3a49ce63
commit 409878e173
1 file changed
+15 -13
+15 -13
View File
@@ -372,16 +372,14 @@ Handler createVodStreamHandler(
final ffmpegArgs = <String>[ final ffmpegArgs = <String>[
'-hide_banner', '-hide_banner',
'-loglevel', '-loglevel',
'error', 'warning',
]; ];
// NVIDIA GPU Hardware Acceleration // NVIDIA GPU Hardware Acceleration
if (useNvidiaGpu) { if (useNvidiaGpu) {
ffmpegArgs.addAll([ ffmpegArgs.addAll([
'-hwaccel', '-hwaccel', 'cuda',
'cuda', // Note: Don't use hwaccel_output_format cuda - it can cause issues
'-hwaccel_output_format',
'cuda',
]); ]);
} }
@@ -396,13 +394,15 @@ Handler createVodStreamHandler(
'-reconnect_streamed', '-reconnect_streamed',
'1', '1',
'-reconnect_delay_max', '-reconnect_delay_max',
'5', '10',
'-rw_timeout', '-rw_timeout',
'15000000', '30000000',
'-timeout',
'30000000',
'-analyzeduration', '-analyzeduration',
'2000000', '5000000',
'-probesize', '-probesize',
'2000000', '10000000',
'-i', '-i',
targetUrl, targetUrl,
]); ]);
@@ -412,12 +412,14 @@ Handler createVodStreamHandler(
// NVIDIA NVENC - Hardware encoding (50x+ faster, much lower CPU) // NVIDIA NVENC - Hardware encoding (50x+ faster, much lower CPU)
ffmpegArgs.addAll([ ffmpegArgs.addAll([
'-c:v', 'h264_nvenc', // Use NVIDIA NVENC encoder '-c:v', 'h264_nvenc', // Use NVIDIA NVENC encoder
'-preset', 'p4', // Good quality/speed balance (p1=fastest, p7=best) '-preset', 'p4', // Good quality/speed balance
'-tune', 'hq', // High quality mode '-tune', 'hq', // High quality mode
'-rc', 'vbr', // Variable bitrate '-rc', 'cbr', // Constant bitrate for HLS
'-cq', '23', // Quality level (similar to CRF) '-b:v', '4000k', // Target bitrate
'-maxrate', '4000k', '-maxrate', '4500k',
'-bufsize', '8000k', '-bufsize', '8000k',
'-g', '48', // Keyframe every 2 seconds
'-bf', '2', // B-frames for quality
'-pix_fmt', 'yuv420p', '-pix_fmt', 'yuv420p',
]); ]);
} else { } else {