Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- res.writeHead(200, {
- 'Content-Type': 'audio/mpeg',
- 'Content-Length': size - startByte,
- 'Transfer-Encoding': 'chuncked',
- 'Cache-Control': "no-cache",
- 'Connection': 'Keep-Alive'
- });
- ffmpeg(assetUrl)
- //.withDuration(60)
- //.seek(30)
- .format("mp3")
- .audioQuality(5)
- .withNoVideo()
- .audioBitrate(96)
- .audioChannels(2)
- .audioFrequency(44100)
- .audioFilters([
- {
- filter: 'volume',
- options: ['0.4']
- },
- {
- filter: 'silencedetect',
- options: { n: '-50dB', d: 5 }
- }
- ])
- .on('end', function(err) {
- console.log('done!', err)
- })
- .on('error', function(err) {
- console.log('an error: ' + err);
- })
- .stream().pipe(res, { end: true })
Add Comment
Please, Sign In to add comment