Fix high framerate preview playback
This commit is contained in:
@@ -273,7 +273,7 @@ pub async fn generate_preview_clip(input_file: &str, output_file: &str) -> Resul
|
||||
let interval = duration / segment_count as f64;
|
||||
|
||||
let vf = format!(
|
||||
"select='lt(mod(t,{:.4}),1)',setpts=N/FRAME_RATE/TB,scale=-2:480",
|
||||
"select='lt(mod(t,{:.4}),1)',setpts=N/30/TB,scale=-2:480",
|
||||
interval
|
||||
);
|
||||
let af = format!(
|
||||
@@ -285,6 +285,10 @@ pub async fn generate_preview_clip(input_file: &str, output_file: &str) -> Resul
|
||||
cmd.args(["-af", &af]);
|
||||
}
|
||||
|
||||
// Force 30fps output so high-framerate sources (60fps) don't play back
|
||||
// at double speed due to select/setpts timestamp mismatches.
|
||||
cmd.args(["-r", "30"]);
|
||||
|
||||
// Use NVENC for encoding when available, otherwise fall back to libx264
|
||||
if use_nvenc {
|
||||
cmd.args(["-c:v", "h264_nvenc", "-preset", "p4", "-cq:v", "28"]);
|
||||
|
||||
Reference in New Issue
Block a user