27

How can I record a radio stream in Linux like the screamer in Windows? Does anyone have any idea or suggestion?

1
  • 1
    Are you talking about radio from an FM receiver, or radio as a stream over the Internet? If the latter, what protocol does it use? Commented Aug 7, 2013 at 23:10

7 Answers 7

19

GUI

Audacity

If you want a GUI to do this you can do it using Audacity.

excerpt from wiki

In the drop-down menu on Audacity's Device Toolbar, choose “Wave Out” or “Stereo Mix” as the input source. (The exact name may be different, depending on your computer's sound drivers). On Windows, if you don't have a “Wave Out” or “Stereo Mix” option, or if it won't record, go to the system Control Panel and try to enable this option there. For instructions see: Using the Control Panel on the Wiki.

Streamtuner

You can also install streamtuner to browse radio stations.

# Debian/Ubuntu $ apt-get install streamtuner # Fedora/CentOS/RHEL $ yum install streamtuner 

screenshot of streamtuner

   ss of streamtuner

commandline

You can install streamripper like so:

# Debian/Ubuntu $ sudo apt-get install streamripper # Fedora/CentOS/RHEL $ sudo yum install streamripper 
example

To download a stream simply do the following:

$ streamripper <url> 

This will save each stream into a .mp3 file.

References

2
  • Hi! I realize this is pretty old response, but are you sure there is port for CentOS available? I get No package streamripper available Commented Mar 21, 2016 at 19:56
  • @katit - there was when I wrote this answer. I only ever used Fedora/CentOS systems so I'm sure there was. Commented Mar 21, 2016 at 20:21
18

With curl from the terminal, for example:

curl --output ~/Downloads/Radio/CostaDelMar.mp3 http://sc-costadelmar.1.fm:10156 

Useful options are --max-time <seconds> and --max-filesize <bytes>.

1
  • In case your stream redirects before playing, use the -L flag to have curl follow the Location header (where the redirect is). Commented Jul 28, 2021 at 18:49
4

Check my radio:

Example WeFunkRadio.

For the first download playlist and get server address & port:

# http://www.wefunkradio.com/play/shoutcast.pls # cat shoutcast.pls [playlist] NumberOfEntries=2 File1=http://wefunkhub.com/radiodrops/introdrop-keithmurray2.mp3 File2=http://stream-90.shoutcast.com:80/wefunk_radio_mp3_64kbps 

This is the address of server: http://stream-90.shoutcast.com:80

To play stream:

# mplayer "http://stream-90.shoutcast.com:80" 

To save stream:

# wget -O stream.mp3 "http://stream-90.shoutcast.com:80" 
4

A tip related to answer of user170267: You can avoid overwriting previous recording by making use of date&time for file name:

 curl --output ~/Downloads/Radio/CostaDelMar_$(date '+%F_%T').mp3 http://sc-costadelmar.1.fm:10156 
4

I use ffmpeg. Example:

ffmpeg -i "http://audio.wbhm.org:8000/live.mp3" out.mp3

To record a particular program you can do the following:

Set a cron job. For example:
20 11 * * 0 /path/sermon-recording.sh

Script:

#!/bin/bash today=$(date +%Y-%m-%d) timeout 65m ffmpeg -i http://briarwood.primcast.com:5182 Sermon_${today}.wav > /dev/null 2>&1 

I use the timeout command to end recording after a certain amount of time. I redirect the output to /dev/null to avoid getting a system mail message with the output.

2
  • To set a ffmpeg timeout (see script) it is probably better to use the 't option: ffmpeg -t 3900 -i http://briarwood.primcast.com:5182 Sermon_${today}.wav > /dev/null 2>&1 (3900 = 65m). For me the script, as is now, didn't work. However, the answer fits my needs the best. Thank you. Commented Mar 1, 2023 at 19:22
  • I did not realize the -t flag would work for that. Nice. Thanks. That URL is now dead. Commented Mar 1, 2023 at 21:05
3

I'm not familiar with screamer, but it sounds like streamripper is what you want. It may already be available in your distro or you can get it at http://streamripper.sourceforge.net/

1

Audio-recorder is another very simple option. Full instructions here.

First install from repository:

sudo add-apt-repository ppa:audio-recorder/ppa sudo apt-get -y update sudo apt-get install --reinstall audio-recorder 

Then, select built-in audio output as source:

enter image description here

Finally, select quality, location, file name, and just start recording.

Notice this will record everything coming from your computer (e.g. sounds from new emails, etc). So make sure everything else is off. This is surely the biggest drawback of the method.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.