key out gif backgrounds

This commit is contained in:
2026-11-09 17:24:00 +02:00
parent 9b31e2daa9
commit 81478cd08c
7 changed files with 148 additions and 18 deletions
+80 -8
View File
@@ -102,6 +102,7 @@ pub(crate) struct TranscodeRequest {
pub crop: Option<CaptureRect>, pub crop: Option<CaptureRect>,
pub gif_budget_mode: GifBudgetMode, pub gif_budget_mode: GifBudgetMode,
pub gif_colors: u16, pub gif_colors: u16,
pub gif_color_key: Option<GifColorKey>,
pub gif_removed_ranges: Vec<SourceRange>, pub gif_removed_ranges: Vec<SourceRange>,
pub trim_start_secs: Option<f64>, pub trim_start_secs: Option<f64>,
pub trim_end_secs: Option<f64>, pub trim_end_secs: Option<f64>,
@@ -116,6 +117,12 @@ pub(crate) struct TranscodeRequest {
pub cancel: Option<Arc<AtomicBool>>, pub cancel: Option<Arc<AtomicBool>>,
} }
#[derive(Debug, Clone, Copy, serde::Deserialize)]
pub(crate) struct GifColorKey {
pub rgb: u32,
pub tolerance: u8,
}
const MAX_CLICK_HIGHLIGHTS: usize = 50; const MAX_CLICK_HIGHLIGHTS: usize = 50;
const BOX_SIZE: i32 = 24; const BOX_SIZE: i32 = 24;
@@ -870,7 +877,7 @@ fn gif_filters(req: &TranscodeRequest, scale_width: u32, effective_fps: u32) ->
.map(|c| format!("{c},")) .map(|c| format!("{c},"))
.unwrap_or_default(); .unwrap_or_default();
let timeline = gif_timeline_filter(req, effective_fps); let timeline = gif_timeline_filter(req, effective_fps);
let stats = if req.gif_removed_ranges.is_empty() { "diff" } else { "full" }; let stats = if req.gif_removed_ranges.is_empty() && req.gif_color_key.is_none() { "diff" } else { "full" };
let dither = match req.gif_dither { let dither = match req.gif_dither {
GifDither::FloydSteinberg => "floyd_steinberg", GifDither::FloydSteinberg => "floyd_steinberg",
@@ -880,8 +887,8 @@ fn gif_filters(req: &TranscodeRequest, scale_width: u32, effective_fps: u32) ->
// Single-pass approach: split the stream, generate palette from one copy, // Single-pass approach: split the stream, generate palette from one copy,
// apply palette to the other. The fps filter handles frame rate conversion. // apply palette to the other. The fps filter handles frame rate conversion.
let scale = gif_rgb_scale_filter(scale_width); let scale = gif_rgb_scale_filter(scale_width, req.gif_color_key);
let colors = req.gif_colors; let colors = if req.gif_color_key.is_some() { req.gif_colors.max(3) } else { req.gif_colors };
let reserve = u8::from(colors > 2); let reserve = u8::from(colors > 2);
format!( format!(
"{kprefix}{cprefix}{timeline},{scale},split[s0][s1];[s0]palettegen=stats_mode={stats}:max_colors={colors}:reserve_transparent={reserve}[p];[s1][p]paletteuse=dither={d}", "{kprefix}{cprefix}{timeline},{scale},split[s0][s1];[s0]palettegen=stats_mode={stats}:max_colors={colors}:reserve_transparent={reserve}[p];[s1][p]paletteuse=dither={d}",
@@ -931,10 +938,20 @@ fn encode_gif_pass(
Ok(()) Ok(())
} }
fn gif_rgb_scale_filter(width: u32) -> String { fn gif_source_rgb_scale(width: u32) -> String {
format!( format!("scale={width}:-1:flags=lanczos:in_color_matrix=bt709:in_range=tv:out_range=pc")
"scale={width}:-1:flags=lanczos:in_color_matrix=bt709:in_range=tv:out_range=pc:in_primaries=bt709:in_transfer=bt709:out_primaries=bt709:out_transfer=srgb,format=rgb24" }
)
fn gif_rgb_scale_filter(width: u32, key: Option<GifColorKey>) -> String {
let scale = gif_source_rgb_scale(width);
let transfer = "in_primaries=bt709:in_transfer=bt709:out_primaries=bt709:out_transfer=srgb";
if let Some(key) = key {
// Match before the transfer conversion changes the RGB values.
let similarity = f64::from(key.tolerance) / 100.0;
format!("{scale},format=rgba,colorkey=0x{:06x}:{similarity:.2}:0,scale={transfer},format=rgba", key.rgb)
} else {
format!("{scale}:{transfer},format=rgb24")
}
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@@ -1605,6 +1622,7 @@ mod tests {
crop: None, crop: None,
gif_budget_mode: GifBudgetMode::Balanced, gif_budget_mode: GifBudgetMode::Balanced,
gif_colors: 256, gif_colors: 256,
gif_color_key: None,
gif_removed_ranges: vec![], gif_removed_ranges: vec![],
trim_start_secs: None, trim_start_secs: None,
trim_end_secs: None, trim_end_secs: None,
@@ -1693,7 +1711,7 @@ mod tests {
#[test] #[test]
fn gif_scale_forces_bt709_rgb() { fn gif_scale_forces_bt709_rgb() {
let filter = gif_rgb_scale_filter(640); let filter = gif_rgb_scale_filter(640, None);
assert!(filter.contains("in_color_matrix=bt709")); assert!(filter.contains("in_color_matrix=bt709"));
assert!(filter.contains("in_range=tv")); assert!(filter.contains("in_range=tv"));
assert!(filter.contains("in_transfer=bt709")); assert!(filter.contains("in_transfer=bt709"));
@@ -1761,6 +1779,60 @@ mod tests {
Ok(()) Ok(())
} }
#[test]
#[ignore = "requires FFmpeg; set BYTESIZE_TEST_FFMPEG"]
fn gif_color_key_clears_the_background_across_frames() -> Result<()> {
let ffmpeg = std::env::var_os("BYTESIZE_TEST_FFMPEG").map(PathBuf::from)
.ok_or_else(|| anyhow!("set BYTESIZE_TEST_FFMPEG to ffmpeg.exe"))?;
let dir = std::env::temp_dir().join(format!("bytesize-gif-key-test-{}", std::process::id()));
std::fs::create_dir_all(&dir)?;
let input = TempFileGuard::create_in(&dir, "source", "mp4")?;
let mut source = Command::new(&ffmpeg);
source.args(["-y", "-hide_banner"]);
for (color, x) in [("0x00ff00", 8), ("0x00f000", 72)] {
let frame = format!("color=c={color}:size=128x96:rate=5:duration=1,format=rgb24,drawbox=x={x}:y=16:w=48:h=64:color=red:t=fill");
source.args(["-f", "lavfi", "-i", &frame]);
}
source.args(["-filter_complex", "concat=n=2:v=1:a=0,scale=out_color_matrix=bt709:out_range=tv,format=yuv420p",
"-c:v", "libx264", "-color_primaries", "bt709", "-color_trc", "bt709", "-colorspace", "bt709"]).arg(&input.0);
run(&mut source, "test recording")?;
for key in [None, Some(GifColorKey { rgb: 0x00_ff_00, tolerance: 8 })] {
let output = TempFileGuard::create_in(&dir, "review", "gif")?;
let mut request = dummy_request();
request.format = Format::Gif;
request.input = input.0.clone();
request.output = output.0.clone();
request.scratch_dir = dir.clone();
request.target_bytes = 1_000_000;
request.clip_width = 128;
request.clip_height = 96;
request.duration_secs = 2.0;
request.fps = 5;
request.gif_colors = if key.is_some() { 3 } else { 256 };
request.gif_color_key = key;
transcode(&ffmpeg, &request)?;
let media = inspect_output(&ffmpeg, &output.0)?;
let decoded = Command::new(&ffmpeg).args(["-v", "error", "-i"]).arg(&output.0)
.args(["-fps_mode", "passthrough", "-pix_fmt", "rgba", "-f", "rawvideo", "pipe:1"]).output()?;
assert!(decoded.status.success());
let (width, height) = (media.width as usize, media.height as usize);
let frames: Vec<_> = decoded.stdout.chunks_exact(width * height * 4).collect();
assert_eq!(frames.len(), 10);
let background_alpha = if key.is_some() { 0 } else { 255 };
for (index, frame) in frames.into_iter().enumerate() {
let (foreground_x, background_x) = if index < 5 { (width / 4, width * 3 / 4) } else { (width * 3 / 4, width / 4) };
let pixel = |x| (width * (height / 2) + x) * 4;
assert_eq!(frame[pixel(background_x) + 3], background_alpha, "frame {index}");
assert_eq!(frame[pixel(foreground_x) + 3], 255, "frame {index}");
assert!(frame[pixel(foreground_x)] > 180, "frame {index} lost its red subject");
}
}
drop(input);
std::fs::remove_dir(dir)?;
Ok(())
}
#[test] #[test]
fn audio_alignment_pads_whole_sample_frames_and_preserves_retry_gaps() { fn audio_alignment_pads_whole_sample_frames_and_preserves_retry_gaps() {
let dir = std::env::temp_dir(); let dir = std::env::temp_dir();
+8 -1
View File
@@ -812,6 +812,8 @@ pub struct ExportRequest {
pub gif_dither: Option<GifDither>, pub gif_dither: Option<GifDither>,
#[serde(default)] #[serde(default)]
pub gif_colors: Option<u16>, pub gif_colors: Option<u16>,
#[serde(default)]
gif_color_key: Option<encode::GifColorKey>,
} }
#[tauri::command] #[tauri::command]
@@ -1012,7 +1014,7 @@ mod tests {
let artifact = encode::TempFileGuard::create_in(&dir, "output-review", ext_for(format))?; let artifact = encode::TempFileGuard::create_in(&dir, "output-review", ext_for(format))?;
let req = encode::TranscodeRequest { let req = encode::TranscodeRequest {
input: source.0.clone(), output: artifact.0.clone(), format, target_bytes: 102_400, input: source.0.clone(), output: artifact.0.clone(), format, target_bytes: 102_400,
duration_secs: 1.0, fps: 10, keep_audio: false, gif_colors: 128, duration_secs: 1.0, fps: 10, keep_audio: false, gif_colors: 128, gif_color_key: None,
gif_dither: GifDither::Bayer, gif_budget_mode: GifBudgetMode::Balanced, gif_dither: GifDither::Bayer, gif_budget_mode: GifBudgetMode::Balanced,
webm_codec: config::WebmCodec::Vp9, mp4_codec: config::Mp4Codec::H264, webm_codec: config::WebmCodec::Vp9, mp4_codec: config::Mp4Codec::H264,
scratch_dir: dir.clone(), crop: None, gif_removed_ranges: Vec::new(), scratch_dir: dir.clone(), crop: None, gif_removed_ranges: Vec::new(),
@@ -2057,6 +2059,10 @@ fn transcode_request(
let mut duration_secs = end - start; let mut duration_secs = end - start;
let mut gif_removed_ranges = Vec::new(); let mut gif_removed_ranges = Vec::new();
let gif_color_key = if request.format == Format::Gif { request.gif_color_key } else { None };
if gif_color_key.is_some_and(|key| key.rgb > 0xff_ffff || !(1..=100).contains(&key.tolerance)) {
return Err("choose an RGB key color and a tolerance between 1% and 100%".to_string());
}
if request.format == Format::Gif { if request.format == Format::Gif {
let rate = f64::from(request.fps); let rate = f64::from(request.fps);
request.gif_removed_ranges.extend(request.deleted_frame_indices.iter().map(|index| SourceRange { request.gif_removed_ranges.extend(request.deleted_frame_indices.iter().map(|index| SourceRange {
@@ -2095,6 +2101,7 @@ fn transcode_request(
keep_audio: request.keep_audio, keep_audio: request.keep_audio,
gif_dither: request.gif_dither.unwrap_or(cfg.export.gif_dither), gif_dither: request.gif_dither.unwrap_or(cfg.export.gif_dither),
gif_colors: request.gif_colors.unwrap_or(256), gif_colors: request.gif_colors.unwrap_or(256),
gif_color_key,
webm_codec: cfg.export.webm_codec, webm_codec: cfg.export.webm_codec,
mp4_codec: cfg.export.mp4_codec, mp4_codec: cfg.export.mp4_codec,
scratch_dir: temp_dir(&state.app_dir), scratch_dir: temp_dir(&state.app_dir),
+4 -4
View File
@@ -8,18 +8,18 @@
import Slider from "./ui/Slider.svelte" import Slider from "./ui/Slider.svelte"
import Toggle from "./ui/Toggle.svelte" import Toggle from "./ui/Toggle.svelte"
import { appear } from "./ui/motion" import { appear } from "./ui/motion"
import GifControls from "./GifControls.svelte" import GifControls, { type GifKeySettings } from "./GifControls.svelte"
import OutputDestination from "./OutputDestination.svelte" import OutputDestination from "./OutputDestination.svelte"
let { let {
clip, format, onFormat, targetMB = $bindable(), fps = $bindable(), keepAudio = $bindable(), clip, format, onFormat, targetMB = $bindable(), fps = $bindable(), keepAudio = $bindable(),
gifBudgetMode = $bindable(), gifDither = $bindable(), gifColors = $bindable(), gifBudgetMode = $bindable(), gifDither = $bindable(), gifColors = $bindable(), gifColorKey = $bindable(),
cropEnabled = $bindable(), cropX = $bindable(), cropY = $bindable(), cropW = $bindable(), cropH = $bindable(), cropEnabled = $bindable(), cropX = $bindable(), cropY = $bindable(), cropW = $bindable(), cropH = $bindable(),
outputPath = $bindable(), invalidDraft = $bindable(), estimatedOutput, trimmedDuration, cropInvalid, emptyGif, disabled, outputPath = $bindable(), invalidDraft = $bindable(), estimatedOutput, trimmedDuration, cropInvalid, emptyGif, disabled,
reviewState, onPathInput, onBrowse, onReview, onSave, reviewState, onPathInput, onBrowse, onReview, onSave,
}: { }: {
clip: RecordedClip; format: Format; onFormat: (format: Format) => void; targetMB: number; fps: number; keepAudio: boolean clip: RecordedClip; format: Format; onFormat: (format: Format) => void; targetMB: number; fps: number; keepAudio: boolean
gifBudgetMode: GifBudgetMode; gifDither: GifDither; gifColors: number; cropEnabled: boolean gifBudgetMode: GifBudgetMode; gifDither: GifDither; gifColors: number; gifColorKey: GifKeySettings; cropEnabled: boolean
cropX: number; cropY: number; cropW: number; cropH: number; outputPath: string; invalidDraft: string | null cropX: number; cropY: number; cropW: number; cropH: number; outputPath: string; invalidDraft: string | null
estimatedOutput: string; trimmedDuration: number; cropInvalid: boolean; emptyGif: boolean; disabled: boolean estimatedOutput: string; trimmedDuration: number; cropInvalid: boolean; emptyGif: boolean; disabled: boolean
reviewState: "none" | "current" | "stale" reviewState: "none" | "current" | "stale"
@@ -62,7 +62,7 @@
</div> </div>
{#if format === "gif"} {#if format === "gif"}
<div class="rail-group" use:appear> <div class="rail-group" use:appear>
<GifControls bind:budgetMode={gifBudgetMode} bind:dither={gifDither} bind:colors={gifColors} {disabled} /> <GifControls bind:budgetMode={gifBudgetMode} bind:dither={gifDither} bind:colors={gifColors} bind:colorKey={gifColorKey} {disabled} />
</div> </div>
{/if} {/if}
<div class="rail-group"> <div class="rail-group">
+42 -3
View File
@@ -1,22 +1,61 @@
<script module lang="ts">
export type GifKeySettings = { enabled: boolean; color: string; tolerance: number }
</script>
<script lang="ts"> <script lang="ts">
import type { GifBudgetMode, GifDither } from "./api" import type { GifBudgetMode, GifDither } from "./api"
import Dropdown from "./ui/Dropdown.svelte" import Dropdown from "./ui/Dropdown.svelte"
import Slider from "./ui/Slider.svelte" import Slider from "./ui/Slider.svelte"
import Toggle from "./ui/Toggle.svelte"
import { fadeMotion } from "./ui/motion"
let { budgetMode = $bindable(), dither = $bindable(), colors = $bindable(), disabled = false }: { let { budgetMode = $bindable(), dither = $bindable(), colors = $bindable(), colorKey = $bindable(), disabled = false }: {
budgetMode: GifBudgetMode; dither: GifDither; colors: number; disabled?: boolean budgetMode: GifBudgetMode; dither: GifDither; colors: number; colorKey: GifKeySettings; disabled?: boolean
} = $props() } = $props()
const priorities = [ const priorities = [
{ value:"balanced", label:"Balanced" }, { value:"resolution", label:"Preserve resolution" }, { value:"framerate", label:"Preserve frame rate" }, { value:"balanced", label:"Balanced" }, { value:"resolution", label:"Preserve resolution" }, { value:"framerate", label:"Preserve frame rate" },
] as const ] as const
const dithers = [{ value:"floyd_steinberg",label:"Floyd-Steinberg" }, { value:"bayer",label:"Bayer" }, { value:"none",label:"None" }] as const const dithers = [{ value:"floyd_steinberg",label:"Floyd-Steinberg" }, { value:"bayer",label:"Bayer" }, { value:"none",label:"None" }] as const
function toggleKey(enabled: boolean) {
colorKey.enabled = enabled
if (enabled && colors < 3) colors = 3
}
</script> </script>
<h3>GIF compression</h3> <h3>GIF compression</h3>
<div class="form-field"><span>Budget priority</span><Dropdown label="GIF budget priority" bind:value={budgetMode} options={priorities} {disabled} /></div> <div class="form-field"><span>Budget priority</span><Dropdown label="GIF budget priority" bind:value={budgetMode} options={priorities} {disabled} /></div>
<div> <div>
<div class="row between"><span>Palette colors</span><output class="mono">{colors}</output></div> <div class="row between"><span>Palette colors</span><output class="mono">{colors}</output></div>
<Slider label="GIF palette colors" bind:value={colors} min={2} max={256} {disabled} /> <Slider label="GIF palette colors" bind:value={colors} min={colorKey.enabled ? 3 : 2} max={256} {disabled} />
</div> </div>
<div class="form-field"><span>Dithering</span><Dropdown label="GIF dithering" bind:value={dither} options={dithers} {disabled} /></div> <div class="form-field"><span>Dithering</span><Dropdown label="GIF dithering" bind:value={dither} options={dithers} {disabled} /></div>
<div class="row between">
<span>Color key transparency</span>
<Toggle label="Color key transparency" checked={colorKey.enabled} onchange={toggleKey} {disabled} />
</div>
{#if colorKey.enabled}
<div class="key-settings stack" transition:fadeMotion inert={!colorKey.enabled}>
<label class="form-field">
<span>Key color</span>
<span class="field mono key-picker">
<span class="swatch" style:background={colorKey.color} aria-hidden="true"></span>
<span aria-hidden="true">{colorKey.color.toUpperCase()}</span>
<input type="color" bind:value={colorKey.color} {disabled} />
</span>
</label>
<div>
<div class="row between"><span>Color tolerance</span><output class="mono">{colorKey.tolerance}%</output></div>
<Slider label="Color tolerance" bind:value={colorKey.tolerance} min={1} max={100} {disabled} valueText={colorKey.tolerance + "%"} />
<p class="note">Higher tolerance removes more colors close to the key.</p>
</div>
</div>
{/if}
<style>
.key-picker { position:relative; display:flex; align-items:center; gap:8px; }
.key-picker:has(input:focus-visible) { outline:var(--edge) solid var(--ink); outline-offset:4px; }
.key-picker input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.key-picker input:disabled { cursor:default; }
.swatch { width:24px; height:20px; border:1px solid var(--field); border-radius:var(--mark-radius); }
</style>
+8 -1
View File
@@ -19,6 +19,7 @@
import ReviewPlayer from "./ReviewPlayer.svelte" import ReviewPlayer from "./ReviewPlayer.svelte"
import OutputDestination from "./OutputDestination.svelte" import OutputDestination from "./OutputDestination.svelte"
import FramesStrip from "./FramesStrip.svelte" import FramesStrip from "./FramesStrip.svelte"
import type { GifKeySettings } from "./GifControls.svelte"
import ExportSidebar from "./ExportSidebar.svelte" import ExportSidebar from "./ExportSidebar.svelte"
import { minTargetMB } from "./exportSizing" import { minTargetMB } from "./exportSizing"
import { clipRanges, rangesDuration } from "./gifFrames" import { clipRanges, rangesDuration } from "./gifFrames"
@@ -49,6 +50,8 @@
let pathOverridden: boolean = $state(false) let pathOverridden: boolean = $state(false)
let gifBudgetMode: GifBudgetMode = $state("balanced") let gifBudgetMode: GifBudgetMode = $state("balanced")
const defaultGifKey: GifKeySettings = { enabled: false, color: "#00ff00", tolerance: 8 }
let gifColorKey = $state({ ...defaultGifKey })
let gifDither: GifDither = $state("floyd_steinberg") let gifDither: GifDither = $state("floyd_steinberg")
let gifColors: number = $state(256) let gifColors: number = $state(256)
@@ -481,6 +484,9 @@
gif_budget_mode: format === "gif" ? gifBudgetMode : undefined, gif_budget_mode: format === "gif" ? gifBudgetMode : undefined,
gif_dither: format === "gif" ? gifDither : undefined, gif_dither: format === "gif" ? gifDither : undefined,
gif_colors: format === "gif" ? gifColors : undefined, gif_colors: format === "gif" ? gifColors : undefined,
gif_color_key: format === "gif" && gifColorKey.enabled
? { rgb: Number.parseInt(gifColorKey.color.slice(1), 16), tolerance: gifColorKey.tolerance }
: undefined,
} }
} }
@@ -567,6 +573,7 @@
function startOver() { function startOver() {
clip = null; exportResult = null; errMsg = null; encodeProgress = null clip = null; exportResult = null; errMsg = null; encodeProgress = null
removedFrames = [] removedFrames = []
gifColorKey = { ...defaultGifKey }
renderedOutput = null renderedOutput = null
previewFailure = "" previewFailure = ""
previewSeek = null previewSeek = null
@@ -821,7 +828,7 @@
{/snippet} {/snippet}
</TrimPanel> </TrimPanel>
</div> </div>
<ExportSidebar {clip} {format} onFormat={changeFormat} bind:targetMB bind:fps bind:keepAudio bind:gifBudgetMode bind:gifDither bind:gifColors <ExportSidebar {clip} {format} onFormat={changeFormat} bind:targetMB bind:fps bind:keepAudio bind:gifBudgetMode bind:gifDither bind:gifColors bind:gifColorKey
bind:cropEnabled bind:cropX bind:cropY bind:cropW bind:cropH bind:outputPath bind:invalidDraft={invalidOutputName} bind:cropEnabled bind:cropX bind:cropY bind:cropW bind:cropH bind:outputPath bind:invalidDraft={invalidOutputName}
{estimatedOutput} {trimmedDuration} {cropInvalid} {emptyGif} {reviewState} {estimatedOutput} {trimmedDuration} {cropInvalid} {emptyGif} {reviewState}
disabled={previewLoading || exportPending} onPathInput={() => pathOverridden = true} onBrowse={browseOutput} disabled={previewLoading || exportPending} onPathInput={() => pathOverridden = true} onBrowse={browseOutput}
+4 -1
View File
@@ -64,5 +64,8 @@
.compare { width:min(100%,240px); } .compare { width:min(100%,240px); }
.gif-viewer { display:grid; gap:8px; padding:8px; border:var(--edge) solid var(--rule); border-radius:var(--radius); background:var(--input); } .gif-viewer { display:grid; gap:8px; padding:8px; border:var(--edge) solid var(--rule); border-radius:var(--radius); background:var(--input); }
figcaption, .gif-viewer > .row { padding-inline:4px; } figcaption, .gif-viewer > .row { padding-inline:4px; }
img { display:block; margin:auto; max-width:100%; max-height:48vh; object-fit:contain; border-radius:var(--control-radius); background:#101417; } img {
display:block; margin:auto; max-width:100%; max-height:48vh; object-fit:contain; border-radius:var(--control-radius);
background:conic-gradient(var(--caption) 0 25%, var(--raised) 25% 50%, var(--caption) 50% 75%, var(--raised) 75% 100%) 0 0 / 20px 20px;
}
</style> </style>
+2
View File
@@ -13,6 +13,7 @@ export type AppStatus = {
export type Format = "gif" | "webm" | "mp4" export type Format = "gif" | "webm" | "mp4"
export type GifDither = "floyd_steinberg" | "bayer" | "none" export type GifDither = "floyd_steinberg" | "bayer" | "none"
export type GifBudgetMode = "resolution" | "framerate" | "balanced" export type GifBudgetMode = "resolution" | "framerate" | "balanced"
export type GifColorKey = { rgb: number; tolerance: number }
export type WebmCodec = "vp9" | "av1" export type WebmCodec = "vp9" | "av1"
export type Mp4Codec = "h264" | "h265" export type Mp4Codec = "h264" | "h265"
@@ -124,6 +125,7 @@ export type ExportRequest = {
gif_budget_mode?: GifBudgetMode gif_budget_mode?: GifBudgetMode
gif_dither?: GifDither gif_dither?: GifDither
gif_colors?: number gif_colors?: number
gif_color_key?: GifColorKey
} }
export type SourceRange = { start_secs: number; end_secs: number } export type SourceRange = { start_secs: number; end_secs: number }