Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function broadcastAudio(audioPath) {
- if (!audioPath)
- {
- console.log('No path!');
- return;
- }
- let spawn = child_process.spawn;
- let args = [
- '-re',
- '-i', audioPath,
- '-vn',
- '-c:a libmp3lame',
- '-b:a 320k',
- '-legacy_icecast 1',
- '-content_type audio/mpeg',
- '-f mp3 icecast://source:123@tvoya.mamasha:8000/test',
- ];
- let ffmpeg = spawn('ffmpeg', args);
- ffmpeg.stdout.on('data', function (data) {
- console.log(data);
- });
- ffmpeg.stderr.on('data', function (data) {
- console.log('grep stderr: ' + data);
- });
- ffmpeg.on('close', (code) => {
- console.log('child process exited with code ' + code);
- });
- };
- broadcastAudio('GENTLEMAN (PSY) from Hitler.mp3');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement