Progress
This commit is contained in:
+21
-20
@@ -19,23 +19,24 @@
|
|||||||
"@felte/validator-yup": "^1.1.4",
|
"@felte/validator-yup": "^1.1.4",
|
||||||
"@ffmpeg/core": "^0.12.10",
|
"@ffmpeg/core": "^0.12.10",
|
||||||
"@ffmpeg/ffmpeg": "^0.12.15",
|
"@ffmpeg/ffmpeg": "^0.12.15",
|
||||||
"@fontsource/marck-script": "^5.2.6",
|
"@ffmpeg/util": "^0.12.2",
|
||||||
"@sentry/browser": "^10.8.0",
|
"@fontsource/marck-script": "^5.2.8",
|
||||||
|
"@sentry/browser": "^10.12.0",
|
||||||
"@sentry/tracing": "^7.120.4",
|
"@sentry/tracing": "^7.120.4",
|
||||||
"@simplewebauthn/browser": "^13.1.2",
|
"@simplewebauthn/browser": "^13.2.0",
|
||||||
"@sveltejs/adapter-auto": "^2.1.1",
|
"@sveltejs/adapter-auto": "^2.1.1",
|
||||||
"@sveltejs/adapter-node": "^1.3.1",
|
"@sveltejs/adapter-node": "^1.3.1",
|
||||||
"@sveltejs/kit": "^1.30.4",
|
"@sveltejs/kit": "^1.30.4",
|
||||||
"@tailwindcss/postcss": "^4.1.12",
|
"@tailwindcss/postcss": "^4.1.13",
|
||||||
"@tailwindcss/typography": "^0.5.16",
|
"@tailwindcss/typography": "^0.5.18",
|
||||||
"@types/canvas-confetti": "^1.9.0",
|
"@types/canvas-confetti": "^1.9.0",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/luxon": "^3.7.1",
|
"@types/luxon": "^3.7.1",
|
||||||
"@types/qrcode": "^1.5.5",
|
"@types/qrcode": "^1.5.5",
|
||||||
"@types/sortablejs": "^1.15.8",
|
"@types/sortablejs": "^1.15.8",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
||||||
"@typescript-eslint/parser": "^8.41.0",
|
"@typescript-eslint/parser": "^8.44.0",
|
||||||
"@uppy/compressor": "^1.1.4",
|
"@uppy/compressor": "^1.1.4",
|
||||||
"@uppy/core": "^3.13.1",
|
"@uppy/core": "^3.13.1",
|
||||||
"@uppy/dashboard": "^3.9.1",
|
"@uppy/dashboard": "^3.9.1",
|
||||||
@@ -48,47 +49,47 @@
|
|||||||
"@uppy/xhr-upload": "^3.6.8",
|
"@uppy/xhr-upload": "^3.6.8",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
"canvas-confetti": "^1.9.3",
|
"canvas-confetti": "^1.9.3",
|
||||||
"ckeditor5": "^46.0.2",
|
"ckeditor5": "^46.1.1",
|
||||||
"cookie": "^1.0.2",
|
"cookie": "^1.0.2",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"cssnano": "^7.1.1",
|
"cssnano": "^7.1.1",
|
||||||
"dompurify": "^3.2.6",
|
"dompurify": "^3.2.7",
|
||||||
"eslint": "^9.34.0",
|
"eslint": "^9.36.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"felte": "^1.3.0",
|
"felte": "^1.3.0",
|
||||||
"fuse.js": "^7.1.0",
|
"fuse.js": "^7.1.0",
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
"i18next": "^25.4.2",
|
"i18next": "^25.5.2",
|
||||||
"i18next-browser-languagedetector": "^8.2.0",
|
"i18next-browser-languagedetector": "^8.2.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jws": "^4.0.0",
|
"jws": "^4.0.0",
|
||||||
"luxon": "^3.7.1",
|
"luxon": "^3.7.2",
|
||||||
"marked": "^16.2.1",
|
"marked": "^16.3.0",
|
||||||
"mdsvex": "^0.12.6",
|
"mdsvex": "^0.12.6",
|
||||||
"minisearch": "^7.1.2",
|
"minisearch": "^7.2.0",
|
||||||
"pikaso": "^2.9.0",
|
"pikaso": "^2.9.0",
|
||||||
"plausible-tracker": "^0.3.9",
|
"plausible-tracker": "^0.3.9",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"postcss-import": "^16.1.1",
|
"postcss-import": "^16.1.1",
|
||||||
"postcss-load-config": "^5.1.0",
|
"postcss-load-config": "^6.0.1",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-svelte": "^3.4.0",
|
"prettier-plugin-svelte": "^3.4.0",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"sass": "^1.91.0",
|
"sass": "^1.93.0",
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.1",
|
||||||
"svelte": "^4.0.0",
|
"svelte": "^4.2.20",
|
||||||
"svelte-check": "^3.8.6",
|
"svelte-check": "^3.8.6",
|
||||||
"svelte-preprocess": "^5.1.4",
|
"svelte-preprocess": "^5.1.4",
|
||||||
"svelte-range-slider-pips": "^4.0.7",
|
"svelte-range-slider-pips": "^4.0.7",
|
||||||
"svelte-tippy": "^1.3.2",
|
"svelte-tippy": "^1.3.2",
|
||||||
"swiper": "^11.2.10",
|
"swiper": "^12.0.2",
|
||||||
"tailwindcss": "^4.1.12",
|
"tailwindcss": "^4.1.13",
|
||||||
"thumbhash": "^0.1.1",
|
"thumbhash": "^0.1.1",
|
||||||
"tinykeys": "^3.0.0",
|
"tinykeys": "^3.0.0",
|
||||||
"tippy.js": "^6.3.7",
|
"tippy.js": "^6.3.7",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "~5.0.4",
|
"typescript": "~5.0.4",
|
||||||
"ua-parser-js": "^2.0.4",
|
"ua-parser-js": "^2.0.5",
|
||||||
"vite": "^4.5.14",
|
"vite": "^4.5.14",
|
||||||
"vite-plugin-cross-origin-isolation": "^0.1.6",
|
"vite-plugin-cross-origin-isolation": "^0.1.6",
|
||||||
"vite-plugin-iso-import": "^1.3.0",
|
"vite-plugin-iso-import": "^1.3.0",
|
||||||
|
|||||||
Generated
+1092
-1345
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,8 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';
|
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
||||||
|
import { fetchFile } from '@ffmpeg/util';
|
||||||
import BrownButton from '$lib/components/buttons/brown.svelte';
|
import BrownButton from '$lib/components/buttons/brown.svelte';
|
||||||
import { navbarVisible } from '$lib/stores';
|
import { navbarVisible } from '$lib/stores';
|
||||||
import { getLocalization } from '$lib/i18n';
|
import { getLocalization } from '$lib/i18n';
|
||||||
@@ -55,27 +56,27 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Status.Compressing;
|
status = Status.Compressing;
|
||||||
const ffmpeg = createFFmpeg({
|
const ffmpeg = new FFmpeg();
|
||||||
// log: true,
|
|
||||||
progress: (p) => {
|
|
||||||
if (stats.progress >= 1) {
|
|
||||||
stats.time_elapsed = last_time_elapsed;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
stats.time_elapsed = p.time ?? 0;
|
|
||||||
last_time_elapsed = stats.time_elapsed;
|
|
||||||
stats.progress = p.ratio ?? 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const file = file_input.files[0];
|
const file = file_input.files[0];
|
||||||
original_file_size_in_mi = file.size / 1_048_576;
|
original_file_size_in_mi = file.size / 1_048_576;
|
||||||
ffmpeg.setLogger(({ message }) => {
|
ffmpeg.on('log', ({ message }) => {
|
||||||
const speed_match = message.match(speed_extraction_regex);
|
const speed_match = message.match(speed_extraction_regex);
|
||||||
stats.speed = speed_match ? parseFloat(speed_match[1]) : 0;
|
stats.speed = speed_match ? parseFloat(speed_match[1]) : 0;
|
||||||
});
|
});
|
||||||
await ffmpeg.load();
|
ffmpeg.on('progress', (p) => {
|
||||||
ffmpeg.FS('writeFile', file.name, await fetchFile(file));
|
if (stats.progress >= 1) {
|
||||||
await ffmpeg.run(
|
stats.time_elapsed = last_time_elapsed;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stats.time_elapsed = p.time ?? 0;
|
||||||
|
last_time_elapsed = stats.time_elapsed;
|
||||||
|
stats.progress = p.ratio ?? 0;
|
||||||
|
});
|
||||||
|
await ffmpeg.load({
|
||||||
|
// log: true,
|
||||||
|
});
|
||||||
|
await ffmpeg.writeFile(file.name, await fetchFile(file));
|
||||||
|
await ffmpeg.exec([
|
||||||
'-i',
|
'-i',
|
||||||
file.name,
|
file.name,
|
||||||
'-vcodec',
|
'-vcodec',
|
||||||
@@ -85,8 +86,8 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
'-vf',
|
'-vf',
|
||||||
'scale=1080:-2',
|
'scale=1080:-2',
|
||||||
'out.mp4'
|
'out.mp4'
|
||||||
);
|
]);
|
||||||
const data = await ffmpeg.FS('readFile', 'out.mp4');
|
const data = await ffmpeg.readFile('out.mp4');
|
||||||
file_size_in_mi = data.length / 1_048_576;
|
file_size_in_mi = data.length / 1_048_576;
|
||||||
file_data = new Blob([data]);
|
file_data = new Blob([data]);
|
||||||
status = Status.CompressDone;
|
status = Status.CompressDone;
|
||||||
|
|||||||
Reference in New Issue
Block a user