Fix most broken formats

This commit is contained in:
Bingus_Violet 2023-12-10 23:50:01 -06:00
parent 1c7b486946
commit 46084e7540

View file

@ -45,18 +45,19 @@ app.post("/convert", uploads.single("files"), (req, res) => {
'-preset', preset, '-preset', preset,
'-f', format, '-f', format,
'-loglevel', 'error', '-loglevel', 'error',
'-movflags', 'frag_keyframe+empty_moov',
'-' '-'
], { ], {
stdio: [ stdio: [
'pipe', 'pipe', 'pipe', 'pipe', 'pipe', 'pipe', 'pipe', 'pipe', 'pipe', 'pipe',
], ],
}) })
console.log(fs.statSync(file.path).size)
res.setHeader('Content-Disposition', `attachment; filename="${file.originalname.substring(0, file.originalname.lastIndexOf('.'))}.${formats[format] || format}"`); res.setHeader('Content-Disposition', `attachment; filename="${file.originalname.substring(0, file.originalname.lastIndexOf('.'))}.${formats[format] || format}"`);
ffmpegProcess.stdio[1].pipe(res) ffmpegProcess.stdio[1].pipe(res)
.on("close", () => { .on("close", () => {
console.log("A")
fs.rmSync(file.path) fs.rmSync(file.path)
}) })
}) })