fix GIF speed: remove capture-side fps filter, let encoder handle conversion
The capture pipeline was applying fps=N to drop frames from monitor refresh rate to user fps. Then the GIF encoder applied fps=M on the already-converted file. Double fps conversion = broken frame timestamps = wrong playback speed. Fix: remove fps filter from capture. Intermediate files keep monitor's native refresh rate (e.g. 120fps). The GIF/video encoder's fps filter handles the conversion correctly in one clean step. Also removed redundant -r flag from GIF encoder (already done), and restored the 16:9 preset and low FPS options that were removed earlier.
This commit is contained in:
@@ -58,7 +58,10 @@ impl GraphicsCaptureApiHandler for CaptureHandler {
|
||||
};
|
||||
|
||||
// Reduce frame rate before scaling to avoid processing unnecessary frames
|
||||
filter_parts.push(format!("fps={}", setup.fps));
|
||||
// NOTE: Do NOT add fps filter here - it mangles timestamps and causes
|
||||
// double fps conversion when the GIF/video encoder also applies fps filtering.
|
||||
// The intermediate file keeps the monitor's native refresh rate.
|
||||
// The export pipeline's fps filter handles the conversion correctly.
|
||||
|
||||
if working_width > MAX_ENCODE_WIDTH {
|
||||
filter_parts.push(format!("scale={}:-2", MAX_ENCODE_WIDTH));
|
||||
|
||||
@@ -465,7 +465,7 @@ fn encode_gif_pass(
|
||||
};
|
||||
|
||||
// Single-pass approach: split the stream, generate palette from one copy,
|
||||
// apply palette to the other. Uses -r for output framerate.
|
||||
// apply palette to the other. The fps filter handles frame rate conversion.
|
||||
let filter_complex = format!(
|
||||
"{cprefix}{kprefix}fps={fps},{sprefix}scale={w}:-1:flags=lanczos,split[s0][s1];[s0]palettegen=stats_mode=diff:max_colors={colors}[p];[s1][p]paletteuse=dither={d}",
|
||||
cprefix = crop_prefix,
|
||||
|
||||
Reference in New Issue
Block a user