Saturday 22 May 2010

Playing BBC Radio Streams from the command line

BBC provides xml files for program lists, and media formats, so to play a required program, you have to follow a series of links.

Playing Program with Real and MPlayer

Note: real is now legacy. The BBC support WMA and Flash, so expect the real player to be phased out at any time. Real format is encoded at 44.1kbps (certainly on Radio 7). The URL appears to be a shim - pause is supported, however, fast forward and rewind do not seem to be.

# Download media list
wget http://www.bbc.co.uk/radio/aod/availability/bbc7.xml

# Parse downloaded file, and find program required
# Follow mediaselector link, and download file
wget http://www.bbc.co.uk/mediaselector/4/mtis/stream/b00sdvs3

# Find audio/real media section, and download connection href
wget http://www.bbc.co.uk/iplayer/aod/playlists/3s/vd/s0/0b/RadioBridge_uk_2300_bbc_7
.ram

# Look inside the RAM file to get rtsp link, and play it with mplayer
mplayer rtsp://rm-acl.bbc.co.uk:554/bbc7coyopa/bbc7_-_monday_0000.ra?timestamp=127405
4718&pid=b00sdvs3&BBC-UID=248baf8894393445d52cf093213a72b7d0df08b660c0c2710208a04443d
c5078_n&SSO2-UID=
Playing Program with WMA and MPlayer

The quality of the wma stream is 96Kbps (i.e. higher than the real stream). Pause is supported, however, there is still no fast forward or rewind.
# Download media list
wget http://www.bbc.co.uk/radio/aod/availability/bbc7.xml

# Parse downloaded file, and find program required
# Follow mediaselector link, and download file
wget http://www.bbc.co.uk/mediaselector/4/mtis/stream/b00sdvs3

# Find audio/wma media section, and play it with mplayer
mplayer mms://wm-acl.bbc.co.uk/wms/bbc7coyopa/bbc7_-_monday_0000.wma

No comments:

Post a Comment