Transcoding HTTP mp3 streaming proxy in bashPublished on 29 September 2008
Here's how to make a proxy for streaming mp3s. It transcodes on-the-fly to 64kpbs MP3 using lame. When transcoding is finished, it calls the ./posthandler.sh script, which can either just delete the file, or potentially archive it so you don't need to transcode it again.
One interesting limitation seems to be the buffer size of a fifo pipe in linux. Even though the transcoding step is pretty quick, if a client is connected the transcoding only manages to fill the pipe a couple of hundred k ahead of what is being read.
The -i flag to
tee means it ignores interrupts, and will finish transcoding the file and call the posthandler even if the client disconnects.
Run is like this:
Then hit up a url of your choice using your awesome new proxy:
Not the most scalable solution, but a mildly amusing quick hack.
Recent 10 Articles
- BigWig: A better Erlang webtool (spawnfest entry)
- Erlang rebar tutorial: generating releases and upgrades
- Erlang/OTP releases: rebar, release_handler, .appup, etc
- Rewriting Playdar: C++ to Erlang, massive savings
- Erlang talk at London Hackspace
- Anti-RDBMS: A list of distributed key-value stores
- How we use IRC at Last.fm
- Getting to know ejabberd and writing modules
- ssh hack: connect directly to machine via a firewall box
- A Million-user Comet Application with Mochiweb, Part 3
[ See all 18 articles ]