From 076dc80ed92c5d42b0ed3b6eb205c408e37a4897 Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Sat, 3 Feb 2024 18:07:03 -0600 Subject: [PATCH] Fix 1080p --- index.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 323af88..bb99c12 100644 --- a/index.js +++ b/index.js @@ -29,10 +29,24 @@ app.get("/convert", async (req, res) => { name = name.substring(0, name.lastIndexOf("[") - 1) res.setHeader('Content-Disposition', `attachment; filename="${encodeURIComponent(name)}.${format}"`); - // ffmpegProcess.stderr.setEncoding('utf-8') - // ffmpegProcess.stderr.on('data', (data) => { - // console.log(data) - // }) + const ffmpegProcess = cp.spawn(ffmpeg, [ + '-i', filePath, + '-f', formats[format] || format, + '-movflags', 'frag_keyframe+empty_moov', + '-preset','ultrafast', + '-crf', '23', + '-loglevel', 'error', + '-' + ], { + stdio: [ + 'pipe', 'pipe', 'pipe', 'pipe', 'pipe', + ], + }) + + 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)