Guessing stream codec?
am 22.06.2006 23:30:40 von dave-gnusI am trying to automate the maintenance of a directory of Internet
Radio streams. I want to get stream bitrate and codec type
automatically. Most stations don't put this info in the HTTP header.
I can guess bitrate by streaming a big chunk of data (a meg or more?),
timing it, and dividing bits by seconds. If the stream is a true
radio station and not a file (aka podcast), this guess should be close
to the actual bitrate, modulo some startup burstiness. Unfortunately
I'm not yet sure how to tell a true radio station apart from a
podcast.
The thousand or so stations in my directory all return Content-Type
fields that are in this list:
text/plain audio/x-mpegurl
text/html; charset=ISO-8859-1 audio/x-ms-wax
text/html audio/x-scpls
text/html; charset=utf-8 audio/x-scpls pls
text/plain; charset=iso-8859-1 video/x-ms-asf
text/plain; charset=ISO-8859-1 video/x-ms-asx
text/plain; charset=UTF-8 video/x-ms-wmx
application/octet-stream video/x-ms-wvx
application/x-mplayer2
This doesn't give me the details about the codec that I want (is it
mp3? flac? wma? encrypted?). So I think I need to get a chunk of
data and feed it into some sort of decoder to guess the codec. Can
anyone suggest such a decoder/guesser that runs (or can be ported to)
linux?
Thanks,
Dave