Fix MKV
This commit is contained in:
parent
c05f172aec
commit
369cac20e6
1 changed files with 10 additions and 5 deletions
15
index.js
15
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)
|
||||
|
|
Loading…
Reference in a new issue