web/remux: add speed to progress info

This commit is contained in:
dumbmoron 2024-08-13 15:55:30 +00:00
parent 4c2acc595e
commit 1493762ce9
No known key found for this signature in database

View file

@ -11,13 +11,18 @@
let totalDuration: number | undefined; let totalDuration: number | undefined;
let processedDuration: number | undefined; let processedDuration: number | undefined;
let speed: number | undefined;
let progress = ''; let progress = '';
$: { $: {
if (totalDuration && processedDuration && processing) { if (totalDuration && processedDuration) {
const percentage = ((processedDuration / totalDuration) * 100).toFixed(2); const percentage = Math.min(100, (processedDuration / totalDuration) * 100).toFixed(2);
progress = `(${percentage}%)`; progress = `${percentage}%, ${speed}x`;
} else progress = ''; } else if (processing) {
progress = 'getting video metadata';
} else {
progress = '';
}
} }
let processing = false; let processing = false;
@ -26,6 +31,10 @@
if (progress.out_time_sec) { if (progress.out_time_sec) {
processedDuration = progress.out_time_sec; processedDuration = progress.out_time_sec;
} }
if (progress.speed) {
speed = progress.speed;
}
}); });
ff.init(); ff.init();
@ -83,7 +92,7 @@
<div id="remux-processing" class:processing> <div id="remux-processing" class:processing>
{#if processing} {#if processing}
processing... {progress} processing{progress ? ` (${(progress)})` : ''}...
{:else} {:else}
done! done!
{/if} {/if}