From 369cac20e68d13075702e3d6f374c27dce4d85b3 Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Wed, 17 Jan 2024 19:52:18 -0600 Subject: [PATCH] Fix MKV --- index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index ed89d21..1ecdef0 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,10 @@ const app = express() const MAX_FILESIZE = process.env.MAX_FILESIZE || 500 +var formats = { + "mkv": "matroska" +} + app.get("/convert", async (req, res) => { var file = req.query.file || "" var format = req.query.format @@ -17,7 +21,8 @@ app.get("/convert", async (req, res) => { res.setHeader('Content-Disposition', `attachment; filename="test.${format}"`); const ffmpegProcess = cp.spawn(ffmpeg, [ '-i', filePath, - '-f', format, + '-f', formats[format] || format, + '-movflags', 'frag_keyframe+empty_moov', '-vcodec', 'copy' , '-' ], { @@ -26,10 +31,10 @@ app.get("/convert", async (req, res) => { ], }) - // ffmpegProcess.stderr.setEncoding('utf-8') - // ffmpegProcess.stderr.on('data', (data) => { - // console.log(data) - // }) + ffmpegProcess.stderr.setEncoding('utf-8') + ffmpegProcess.stderr.on('data', (data) => { + console.log(data) + }) // These are debugging lines to watch FFMPEG output :3 ffmpegProcess.stdio[1].pipe(res)