From 3982c6d6d4aa8a0ea2d8110d3034e44440e49058 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 27 Feb 2026 19:55:10 -0500 Subject: [PATCH] Fix 10-bit encode not supported error with h264_nvenc Add format=yuv420p to preview clip filter chains to convert 10-bit sources to 8-bit before encoding, since NVENC doesn't support 10-bit H.264. Co-Authored-By: Claude Opus 4.6 --- src/video/ffmpeg.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/ffmpeg.rs b/src/video/ffmpeg.rs index 0a340d5..ddb35d5 100644 --- a/src/video/ffmpeg.rs +++ b/src/video/ffmpeg.rs @@ -263,7 +263,8 @@ pub async fn generate_preview_clip(input_file: &str, output_file: &str) -> Resul if duration < 1.0 { // Very short video (<1s): transcode the whole thing to 480p MP4 - cmd.args(["-vf", "scale=-2:480"]); + // format=yuv420p ensures 10-bit sources are converted to 8-bit for h264_nvenc + cmd.args(["-vf", "scale=-2:480,format=yuv420p"]); } else { let segment_count = if duration < 10.0 { duration.floor() as u32 @@ -272,8 +273,9 @@ pub async fn generate_preview_clip(input_file: &str, output_file: &str) -> Resul }; let interval = duration / segment_count as f64; + // format=yuv420p ensures 10-bit sources are converted to 8-bit for h264_nvenc let vf = format!( - "select='lt(mod(t,{:.4}),1)',setpts=N/FRAME_RATE/TB,fps=30,scale=-2:480", + "select='lt(mod(t,{:.4}),1)',setpts=N/FRAME_RATE/TB,fps=30,scale=-2:480,format=yuv420p", interval ); let af = format!(