gif color count slider (2-256) and dithering control in editing screen, both wired through export/preview pipeline

This commit is contained in:
2026-05-27 20:03:16 +03:00
parent 2b3f7e433c
commit f15d984532
4 changed files with 57 additions and 6 deletions
+4 -1
View File
@@ -40,6 +40,7 @@ pub struct TranscodeRequest {
pub scratch_dir: PathBuf,
pub crop: Option<CaptureRect>,
pub gif_budget_mode: GifBudgetMode,
pub gif_colors: u16,
pub deleted_frame_indices: Vec<u32>,
pub trim_start_secs: Option<f64>,
pub trim_end_secs: Option<f64>,
@@ -353,12 +354,13 @@ fn encode_gif(ffmpeg: &Path, req: &TranscodeRequest) -> Result<()> {
.map(|s| format!("{s},"))
.unwrap_or_default();
let palettegen_filter = format!(
"{cprefix}{kprefix}fps={fps},{sprefix}scale={w}:-1:flags=lanczos,palettegen=stats_mode=diff",
"{cprefix}{kprefix}fps={fps},{sprefix}scale={w}:-1:flags=lanczos,palettegen=stats_mode=diff:max_colors={colors}",
cprefix = crop_prefix,
kprefix = click_prefix,
sprefix = select_prefix,
fps = effective_fps,
w = scale_width,
colors = req.gif_colors,
);
let mut gen = Command::new(ffmpeg);
@@ -749,6 +751,7 @@ mod tests {
scratch_dir: PathBuf::new(),
crop: None,
gif_budget_mode: GifBudgetMode::Balanced,
gif_colors: 256,
deleted_frame_indices: vec![],
trim_start_secs: None,
trim_end_secs: None,