calibrate gif size, probe codecs, align audio with video

- sample-encode gif calibration before the retry loop
- probe ffmpeg encoders and grey out missing codecs in settings
- pad audio head with silence so it lines up with video start
- cache gif preview palette keyed on colors and sample window
- read encode progress from -progress pipe:1 instead of stderr scraping
- thread bt709 color metadata through capture, fix, and gif scale
- sweep temp on startup
- gif estimate table for the ui, interpolated locally on slider drag
This commit is contained in:
2026-06-17 23:09:53 +03:00
parent 4ca802ef71
commit f732cdda4d
7 changed files with 647 additions and 155 deletions
+20 -6
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount } from "svelte"
import { api, type Config } from "./api"
import { api, type Config, type CodecAvailability } from "./api"
import HotkeyInput from "./HotkeyInput.svelte"
import { open } from "@tauri-apps/plugin-dialog"
@@ -12,6 +12,7 @@
let showAdvanced: boolean = $state(false)
let activeTab: string = $state("capture")
let initialCfg: Config | null = $state(null)
let codecs: CodecAvailability | null = $state(null)
let dirty = $derived.by(() => {
if (!cfg || !initialCfg) return false
@@ -38,7 +39,11 @@
{ id: "system", label: "System" },
]
onMount(async () => { cfg = await api.getConfig(); initialCfg = structuredClone(cfg) })
onMount(async () => {
cfg = await api.getConfig()
initialCfg = structuredClone(cfg)
try { codecs = await api.codecAvailability() } catch { codecs = null }
})
$effect(() => {
if (cfg) document.documentElement.setAttribute("data-theme", cfg.theme)
@@ -165,17 +170,20 @@
<label class="field">
<span class="field-label">WebM codec</span>
<select bind:value={cfg.export.webm_codec}>
<option value="vp9">VP9 (default)</option>
<option value="av1">AV1 (smaller, slower)</option>
<option value="vp9" disabled={codecs ? !codecs.vp9 : false}>VP9 (default){codecs && !codecs.vp9 ? " - unavailable" : ""}</option>
<option value="av1" disabled={codecs ? !codecs.av1 : false}>AV1 (smaller, slower){codecs && !codecs.av1 ? " - unavailable" : ""}</option>
</select>
</label>
<label class="field">
<span class="field-label">MP4 codec</span>
<select bind:value={cfg.export.mp4_codec}>
<option value="h264">H.264 (default)</option>
<option value="h265">H.265 (smaller, less universal)</option>
<option value="h264" disabled={codecs ? !codecs.h264 : false}>H.264 (default){codecs && !codecs.h264 ? " - unavailable" : ""}</option>
<option value="h265" disabled={codecs ? !codecs.h265 : false}>H.265 (smaller, less universal){codecs && !codecs.h265 ? " - unavailable" : ""}</option>
</select>
</label>
{#if codecs && (!codecs.av1 || !codecs.h265)}
<p class="codec-note">Some codecs are unavailable in your ffmpeg build and disabled above.</p>
{/if}
{/if}
</div>
</div>
@@ -442,6 +450,12 @@
.advanced-toggle svg { transition: transform 150ms; }
.advanced-toggle svg.rotated { transform: rotate(180deg); }
.codec-note {
margin: 0;
font-size: 11px;
color: var(--warn);
}
.path-row { display: flex; gap: 6px; }
.path-input { flex: 1; font-family: var(--mono); font-size: 12px; }