Guest User

Untitled

a guest
Jan 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. res.writeHead(200, {
  2. 'Content-Type': 'audio/mpeg',
  3. 'Content-Length': size - startByte,
  4. 'Transfer-Encoding': 'chuncked',
  5. 'Cache-Control': "no-cache",
  6. 'Connection': 'Keep-Alive'
  7. });
  8.  
  9. ffmpeg(assetUrl)
  10. //.withDuration(60)
  11. //.seek(30)
  12. .format("mp3")
  13. .audioQuality(5)
  14. .withNoVideo()
  15. .audioBitrate(96)
  16. .audioChannels(2)
  17. .audioFrequency(44100)
  18. .audioFilters([
  19. {
  20. filter: 'volume',
  21. options: ['0.4']
  22. },
  23. {
  24. filter: 'silencedetect',
  25. options: { n: '-50dB', d: 5 }
  26. }
  27. ])
  28. .on('end', function(err) {
  29. console.log('done!', err)
  30. })
  31. .on('error', function(err) {
  32. console.log('an error: ' + err);
  33. })
  34. .stream().pipe(res, { end: true })
Add Comment
Please, Sign In to add comment