mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-12 03:34:26 +02:00
web/libav/wrapper: add support for encode variant
This commit is contained in:
parent
76462ee665
commit
07443942fb
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -103,6 +103,9 @@ importers:
|
||||
'@fontsource/redaction-10':
|
||||
specifier: ^5.0.2
|
||||
version: 5.0.2
|
||||
'@imput/libav.js-encode-cli':
|
||||
specifier: 6.5.7
|
||||
version: 6.5.7
|
||||
'@imput/libav.js-remux-cli':
|
||||
specifier: ^6.5.7
|
||||
version: 6.5.7
|
||||
@ -557,6 +560,9 @@ packages:
|
||||
resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==}
|
||||
engines: {node: '>=18.18'}
|
||||
|
||||
'@imput/libav.js-encode-cli@6.5.7':
|
||||
resolution: {integrity: sha512-DbMBSibot7I8fASVmNVTIp0/WQrHUUV2jOCkjWBazvJQKr2hG288uFmvxUu+F2d3AFafRGA9xYtjsx8M+RULwQ==}
|
||||
|
||||
'@imput/libav.js-remux-cli@6.5.7':
|
||||
resolution: {integrity: sha512-41ld+R5aEwllKdbiszOoCf+K614/8bnuheTZnqjgZESwDtX07xu9O8GO0m/Cpsm7O2CyqPZa1qzDx6BZVO15DQ==}
|
||||
|
||||
@ -2417,6 +2423,8 @@ snapshots:
|
||||
|
||||
'@humanwhocodes/retry@0.4.1': {}
|
||||
|
||||
'@imput/libav.js-encode-cli@6.5.7': {}
|
||||
|
||||
'@imput/libav.js-remux-cli@6.5.7': {}
|
||||
|
||||
'@imput/psl@2.0.4':
|
||||
|
@ -28,6 +28,7 @@
|
||||
"@fontsource-variable/noto-sans-mono": "^5.0.20",
|
||||
"@fontsource/ibm-plex-mono": "^5.0.13",
|
||||
"@fontsource/redaction-10": "^5.0.2",
|
||||
"@imput/libav.js-encode-cli": "6.5.7",
|
||||
"@imput/libav.js-remux-cli": "^6.5.7",
|
||||
"@imput/version-info": "workspace:^",
|
||||
"@sveltejs/adapter-static": "^3.0.6",
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { OPFSStorage } from "$lib/storage";
|
||||
import LibAV, { type LibAV as LibAVInstance } from "@imput/libav.js-remux-cli";
|
||||
import EncodeLibAV from "@imput/libav.js-encode-cli";
|
||||
|
||||
import type { FfprobeData } from "fluent-ffmpeg";
|
||||
import type { FFmpegProgressCallback, FFmpegProgressEvent, FFmpegProgressStatus, RenderParams } from "$lib/types/libav";
|
||||
@ -16,13 +17,22 @@ export default class LibAVWrapper {
|
||||
}
|
||||
|
||||
init(options?: LibAV.LibAVOpts) {
|
||||
if (!options) options = {
|
||||
yesthreads: true,
|
||||
const variant = options?.variant || 'remux';
|
||||
let constructor: typeof LibAV.LibAV;
|
||||
|
||||
if (variant === 'remux') {
|
||||
constructor = LibAV.LibAV;
|
||||
} else if (variant === 'encode') {
|
||||
constructor = EncodeLibAV.LibAV;
|
||||
} else {
|
||||
throw "invalid variant";
|
||||
}
|
||||
|
||||
if (this.concurrency && !this.libav) {
|
||||
this.libav = LibAV.LibAV({
|
||||
this.libav = constructor({
|
||||
...options,
|
||||
variant: undefined,
|
||||
yesthreads: true,
|
||||
base: '/_libav'
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user