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 <noreply@anthropic.com>
This commit is contained in:
Cameron
2026-02-27 19:55:10 -05:00
parent 27a148c0aa
commit 3982c6d6d4

View File

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