From 7a260c040d1d507a116f008955c160dd21c5e824 Mon Sep 17 00:00:00 2001 From: treamz Date: Sun, 22 Mar 2026 12:22:57 +0300 Subject: [PATCH] Video: estimates update on format change (AVI ~35% larger, MKV ~5%) --- public/video.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/video.html b/public/video.html index 4e92ad1..08c1229 100644 --- a/public/video.html +++ b/public/video.html @@ -740,10 +740,12 @@ // ─── Estimate sizes for compress mode ───────────────────────────────────── function updateEstimates() { if (!state.originalSize) return; - const ratios = { high: 0.70, medium: 0.40, low: 0.20 }; - for (const [q, ratio] of Object.entries(ratios)) { - const el = document.getElementById('est-' + q); - if (el) el.textContent = '~' + formatSize(state.originalSize * ratio); + var formatMult = { mp4: 1.0, avi: 1.35, mkv: 1.05 }; + var fm = formatMult[state.compressFormat || 'mp4'] || 1.0; + var ratios = { high: 0.70, medium: 0.40, low: 0.20 }; + for (var q in ratios) { + var el = document.getElementById('est-' + q); + if (el) el.textContent = '~' + formatSize(state.originalSize * ratios[q] * fm); } } @@ -910,7 +912,7 @@ initBtnGroup('convertFormats', val => { state.format = val; }); initBtnGroup('audioFormats', val => { state.audioFormat = val; }); - initBtnGroup('compressFormats', val => { state.compressFormat = val; }); + initBtnGroup('compressFormats', val => { state.compressFormat = val; updateEstimates(); }); // ─── Quality options ─────────────────────────────────────────────────────── document.querySelectorAll('.quality-option').forEach(label => {