live readout below target-size slider
This commit is contained in:
@@ -204,6 +204,23 @@
|
|||||||
|
|
||||||
let trimmedDuration = $derived(Math.max(0.1, trimEnd - trimStart))
|
let trimmedDuration = $derived(Math.max(0.1, trimEnd - trimStart))
|
||||||
|
|
||||||
|
let previewDims = $derived.by(() => {
|
||||||
|
if (!clip) return "..."
|
||||||
|
if (format === "gif") {
|
||||||
|
const bytesPerPixelPerFrame = 0.5
|
||||||
|
const frames = Math.max(1, fps * trimmedDuration)
|
||||||
|
const budget = (targetMB * 1_048_576) / (frames * bytesPerPixelPerFrame)
|
||||||
|
const aspect = clip.height === 0 ? 16 / 9 : clip.width / clip.height
|
||||||
|
const wRaw = Math.sqrt(budget * aspect)
|
||||||
|
const w = Math.min(clip.width, Math.max(120, Math.round(wRaw)))
|
||||||
|
const h = Math.round(w / aspect)
|
||||||
|
const w2 = (w >> 1) << 1
|
||||||
|
const h2 = (h >> 1) << 1
|
||||||
|
return `${w2}x${h2}`
|
||||||
|
}
|
||||||
|
return `${clip.width}x${clip.height}`
|
||||||
|
})
|
||||||
|
|
||||||
async function doExport() {
|
async function doExport() {
|
||||||
if (!clip) return
|
if (!clip) return
|
||||||
errMsg = null
|
errMsg = null
|
||||||
@@ -400,6 +417,9 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="readout">{targetMB.toFixed(1)} MB</div>
|
<div class="readout">{targetMB.toFixed(1)} MB</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="estimate">
|
||||||
|
{targetMB.toFixed(1)} MB → {previewDims} at {fps}fps, {trimmedDuration.toFixed(1)}s
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<label>
|
<label>
|
||||||
@@ -693,6 +713,12 @@
|
|||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
.estimate {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #888;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
input[type="range"] {
|
input[type="range"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user