How to record online radio streams with Streamripper on a Linux (Raspberry Pi) system

This isn’t a blog post as much as it is just some notes on how I got streamripper working the way I want to on my Raspberry Pi “AlRadio” project. That project is a little like a radio in that it plays FM radio stations, but it also plays live radio streams, makes and plays recorded radio streams, and plays podcasts.

Streamripper in production

I installed streamripper with apt-get like this:

$ sudo apt-get install streamripper

This is the script I use to make recordings of the 104.3 FM radio station here in the Denver area on my AlRadio system:


date=`date +"%Y_%a_%b_%d_%H%M%P"`



cd $output_dir

streamripper $url -d $output_dir -l $duration -a $output_filename -o always

When this script is run via crontab entries, it creates recorded stream files that look like this:


My crontab entries for this script look like this:

# 104.3 (afternoon guys)
0 12 * * * /var/www/radio/data/recordings/  > /var/www/radio/logs/104_3.log 2>&1
0 13 * * * /var/www/radio/data/recordings/  > /var/www/radio/logs/104_3.log 2>&1

Streamripper notes

Everything below this point are notes that I made as I was learning how to use streamripper:

finding a stream

"The easiest way to get started is to find the URL of a stream you want to rip. 
Usually I find the URL by loading it up in Winamp or XMMS and querying for the source URL."


# specify directory
streamripper URL -d recordings

# don't create a directory for each stream

# add sequence number to output file

# suppress the creation of the stream folder by adding -s
streamripper URL -d OutputFolder -s

# run for an hour
-l 3600

# If -D is used, the options -s and -P will be ignored.
# name files with date and time (per exec)
-D %d

%S   Stream
%A   Artist
%T   Title
%a   Album

-a [pattern]
# Sometimes you want the stream recorded to a single (big) file 
  without splitting into tracks. The -a option does this. If you use -a without 
  including the [pattern], a timestamped filename will automatically be used.

Don´t create individual tracks.
The default mode of operation is to create one file for each track. 
But sometimes you don´t want these files.
Using the -A option, the individual files for each track are not created.

# user agent
-u "FreeAmp/2.x"

-o (always | never | larger | version)
Overwrite tracks in `complete` directory. When streamripper rips tracks they are put into 
the incomplete directory until they are finished. Normally, they are then moved into the 
complete directory. However, when the track is already there, can use this option to tell 
streamripper what you want to do.

Quiet operation. Don´t write any text to the console, except error messages

Write output to stderr instead of stdout


streamripper -d recordings -l 5 -s -q -D %S%d

# creates "recordings/foobar/incomplete/ - .aac"
streamripper -d recordings -l 5 -s -q -D foobar

streamripper -d recordings -l 5 -D 104_3

# creates "recordings/104_3.aac"
streamripper -d recordings -l 3 -D 104_3 -a 104_3

date=`date +"%Y_%m_%d"`
streamripper -d recordings -l 3 -D 104_3.${date} -a 104_3.${date}

Streamripper help and useful URLs


Don’t forget to view man streamripper for more help.


If you are interested in using streamripper to make recordings of online radio streams, I hope you find these notes and examples helpful.