Skip to content

Instantly share code, notes, and snippets.

@dctanner
Forked from steveh/server.js
Created April 13, 2011 16:35
Show Gist options
  • Save dctanner/917883 to your computer and use it in GitHub Desktop.
Save dctanner/917883 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