From cd504dab3d71fc0a2d3aa4b9c249e43ec6cae46f Mon Sep 17 00:00:00 2001 From: orfelorfel23 Date: Mon, 10 Aug 2026 21:19:05 +0200 Subject: [PATCH] fix(transcode): keep webm extension so ffmpeg auto-detects vp9 alpha, and drop qtrle to save disk space --- server.mjs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server.mjs b/server.mjs index 8b68ec6..9e94bdd 100644 --- a/server.mjs +++ b/server.mjs @@ -263,7 +263,12 @@ app.post('/api/export/transcode', upload.fields([ return res.status(400).json({ error: 'Video-Datei fehlt für Server-Transcoding.' }); } - const videoPath = req.files.video[0].path; + const videoPathTemp = req.files.video[0].path; + const originalName = req.files.video[0].originalname; + const isWebmInput = originalName.toLowerCase().endsWith('.webm'); + const videoPath = videoPathTemp + (isWebmInput ? '.webm' : '.mp4'); + fs.renameSync(videoPathTemp, videoPath); + const audioPath = (req.files.audio && req.files.audio[0]) ? req.files.audio[0].path : null; const format = req.body.format || 'prores'; const title = (req.body.title || 'Visualizer').replace(/[^a-zA-Z0-9_-]/g, '_'); @@ -323,7 +328,7 @@ app.post('/api/export/transcode', upload.fields([ enforceMaxHistory(); // Run sequentially in background - runSequentialEncodes(session, videoPath, audioPath, ['prores', 'webm_alpha', 'qtrle', 'mp4']).catch(err => { + runSequentialEncodes(session, videoPath, audioPath, ['prores', 'webm_alpha', 'mp4']).catch(err => { console.error(`[${sessionId}] Queue Error:`, err); }); @@ -426,7 +431,7 @@ app.post('/api/export/start', upload.single('audio'), async (req, res) => { session.formats.prores.ready = true; saveHistory(); // Start remaining encodes from the ProRes master file using the original audioPath - runSequentialEncodes(session, formats.prores.path, audioPath, ['webm_alpha', 'qtrle', 'mp4']).catch(err => { + runSequentialEncodes(session, formats.prores.path, audioPath, ['webm_alpha', 'mp4']).catch(err => { console.error(`[${sessionId}] Background Queue Error:`, err); }); }