Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import ffmpeg from 'fluent-ffmpeg';
  2.  
  3. import { settings } from '../../../../system';
  4.  
  5. export default (incomingPatchFile, outgoingPatchFile) => {
  6. const ffmpegPath = settings.get('system.ffmpeg.path', '');
  7.  
  8. ffmpeg.setFfmpegPath(ffmpegPath);
  9.  
  10. return new Promise((resolve, reject) => {
  11. const command = ffmpeg(incomingPatchFile)
  12. .audioBitrate('32k')
  13. .audioChannels(1)
  14. .audioCodec('libmp3lame')
  15. .audioFrequency(22050)
  16. .audioQuality(4)
  17. .format('mp3')
  18. .noVideo();
  19.  
  20. command.on('error', (error) => reject(error));
  21.  
  22. // command.on('start', (commandLine) => {
  23. // logger.debug('Успешно инициализирован ffmpeg', { commandLine });
  24. // });
  25.  
  26. command.on('end', () => resolve());
  27.  
  28. command.output(outgoingPatchFile).run();
  29. });
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement