Skip to content

Instantly share code, notes, and snippets.

@steveh
Created August 9, 2010 03:24
Show Gist options
  • Save steveh/514882 to your computer and use it in GitHub Desktop.
Save steveh/514882 to your computer and use it in GitHub Desktop.
var sys = require('sys'),
spawn = require('child_process').spawn,
http = require('http');
http.createServer(function (req, res) {
var ffmpeg = spawn('ffmpeg', ['-i /path/to/file', '-f mp3', '-']);
res.writeHead(200, {'Content-Type': 'audio/mpeg'});
ffmpeg.stdout.addListener('data', function (d) {
res.write(d);
});
}).listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment