Convert shoutcast stream to playable samples in Python?
I have a shoutcat radio station and now want to build a player for it. I know how to "get" thet stream from the server, thanks a lot to bobince , but I开发者_如何学C am not sure how to convert that stream into playable samples. How is it done?
Shoutcast streams are typically (but not always) MP3. To get playable samples, you have to decode the stream's MP3 data.
Have you seen the resource at http://codeboje.de/playing-mp3-stream-python/? Looks like a simple solution, but requires an awful lot of libraries.
There are quite a few possibilities for MP3 decoding under Python. PyMedia is one I've had some success with in the past (but for which development seems to have stopped). It's not just an MP3 decoder though, but a playback interface with support for many audio and video formats via ffmpeg. There's also pyffmpeg which seems to have come back to life recently (haven't tried it yet).
Then there's PyGame can also play MP3, though this is a pretty small part of what it does. pymad is more lightweight possibility, being a direct interface to the libmad decoder library. And then there's always the possibility of handing the task off to an external multimedia library such as DirectShow, or GStreamer (via gst-python)...
Well, from what I can read on python, try this page. If that doesn't work, try the PythonInMusic article on the python wiki.
精彩评论