SHARE
TWEET

Untitled

a guest Dec 14th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function broadcastAudio(audioPath) {
  2.     if (!audioPath)
  3.     {
  4.         console.log('No path!');
  5.         return;
  6.     }
  7.     let spawn = child_process.spawn;
  8.  
  9.     let args = [
  10.         '-re',
  11.         '-i', audioPath,
  12.         '-vn',
  13.         '-c:a libmp3lame',
  14.         '-b:a 320k',
  15.         '-legacy_icecast 1',
  16.         '-content_type audio/mpeg',
  17.         '-f mp3 icecast://source:123@tvoya.mamasha:8000/test',
  18.     ];
  19.  
  20.  
  21.  
  22.     let ffmpeg = spawn('ffmpeg', args);
  23.  
  24.     ffmpeg.stdout.on('data', function (data) {
  25.         console.log(data);
  26.     });
  27.  
  28.     ffmpeg.stderr.on('data', function (data) {
  29.         console.log('grep stderr: ' + data);
  30.     });
  31.  
  32.     ffmpeg.on('close', (code) => {
  33.         console.log('child process exited with code ' + code);
  34.     });
  35. };
  36.  
  37. broadcastAudio('GENTLEMAN (PSY) from Hitler.mp3');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top