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!(