This commit is contained in:
Bingus_Violet 2024-01-17 19:52:18 -06:00
parent c05f172aec
commit 369cac20e6

View file

@ -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)