mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-17 18:58:33 +00:00
oops
This commit is contained in:
parent
591903cab3
commit
10600a0d28
@ -1,49 +0,0 @@
|
||||
import mime from "mime";
|
||||
import LibAVWrapper from "$lib/libav";
|
||||
|
||||
let speed;
|
||||
let processedDuration;
|
||||
|
||||
const ff = new LibAVWrapper(progress => {
|
||||
if (progress.out_time_sec) {
|
||||
processedDuration = progress.out_time_sec;
|
||||
}
|
||||
|
||||
if (progress.speed) {
|
||||
speed = progress.speed;
|
||||
}
|
||||
});
|
||||
|
||||
ff.init();
|
||||
|
||||
export const silentRemux = async (file: File) => {
|
||||
if (file instanceof File && !file.type) {
|
||||
file = new File([file], file.name, {
|
||||
type: mime.getType(file.name) ?? undefined,
|
||||
});
|
||||
}
|
||||
|
||||
const render = await ff
|
||||
.render({
|
||||
blob: file,
|
||||
args: ["-c", "copy", "-map", "0"],
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("uh-oh! render error");
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
if (!render) {
|
||||
return console.log("not a valid file");
|
||||
}
|
||||
|
||||
const filenameParts = file.name.split(".");
|
||||
const filenameExt = filenameParts.pop();
|
||||
|
||||
const filename = `${filenameParts.join(".")} (remux).${filenameExt}`;
|
||||
|
||||
return new File([render], filename, {
|
||||
type: render.type
|
||||
})
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user