0
var fs = require('fs');
var child = require('child_process');
var http=require('http')
var input_file = fs.createReadStream('./remo.mp3');
http.createServer(function (req,res) {
var args = ['-ss',120,
'-i', 'remo.mp3',
'-f','mp3',
'pipe:1' // Output on stdout
];
var trans_proc = child.spawn('ffmpeg', args);
res.writeHead(200, {
'Content-Type': 'audio/mpeg'
});
trans_proc.stdout.pipe(res)
trans_proc.stderr.on('data',function (err) {
console.log(err.toString());
})
}).listen(2000)
我試圖削減MP3和流式傳輸到瀏覽器,但瀏覽器,它顯示損壞的文件流媒體ffmpeg的MP3通過節點JS