A “proxy” that converts a Real Player audio stream to MP3?

While working on creating an Atom feed from a web page I got the idea to create a proxy that takes an audio stream in Real Player format over RTSP/RTP/RDP and converts it to MP3 over HTTP. It should actually not be harder than to use mplayer to “play” the stream to lame and then output over HTTP. The selling point of this would be the possibility to save the MP3 stream to a file, so that you could for example have an hour of an Internet radio station downloadable as a podcast.

The decoding and subsequent re-encoding would take some bandwidth and CPU power, so there would need be more than one node and maybe both geographic and round-robin assignment of clients to nodes. As the Internet radio stations essentially only send 1 second of radio per second, the bandwidth per client connection would automatically be kept low. No audio data is stored on disk on the nodes, it just shuffled though the proxy.

There is also a potential security issue. If someone could craft a stream that caused mplayer to crash, they might be able to run code on the proxy server. The nodes should probably at least run mplayer chrooted.

An even simpler version would simply provide the Real Player stream over HTTP and that could probably support video quite easily. A more complicated system also re-encodes the video.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.