This commit is contained in:
2026-09-29 04:35:35 +02:00
parent 73c0659d4a
commit 6c813143eb
51 changed files with 3708 additions and 743 deletions
+8
View File
@@ -8,6 +8,7 @@ import autotagger from "../autotagger.mjs";
import fetch from "flumm-fetch";
import fs from "fs";
import path from "path";
import { TRANSCODE_TO_MP4, transcodeToMp4 } from "../transcode.mjs";
const regex = {
@@ -648,6 +649,13 @@ export default async bot => {
source = source.replace(/\.mkv$/, '.mp4');
mime = 'video/mp4';
}
if (TRANSCODE_TO_MP4.has(mime)) { // .mpg etc.: browsers can't play it, re-encode
const converted = path.join(cfg.paths.tmp, `${uuid}.conv.mp4`);
await transcodeToMp4(queue, source, converted);
await fs.promises.unlink(source).catch(_ => { });
source = converted;
mime = 'video/mp4';
}
if (source.match(/\.opus$/)) { // opus failsafe
await queue.spawn('ffmpeg', ['-i', path.join(cfg.paths.tmp, `${uuid}.opus`), '-codec', 'copy', path.join(cfg.paths.tmp, `${uuid}.ogg`)]);
await fs.promises.unlink(source);