omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

Stream audio from command line

Mon Jul 02, 2012 3:25 pm

Hi all,

Apologies, newbie here! Well, new to linux and raspberry pi :P

I would like to have my raspberry pi connect to an audio stream (say from a radio station) on startup, it initially is only required to connect up to one unique stream on startup.

I am unsure as to how to go about this, a requirement is also for it to continuosly connect to this stream, so for example, it could be have the URL of the audio stream in a playlist, which is on repeat.

Ideally it should be able to play AAC+ streams, but MP3 is also OK.

Could anyone kindly point me in the right direction as to how to go about this (ideally with some basic steps!).

Thank you in advance!
Get your Pi from here! http://bit.ly/18blVup

Chii
Posts: 10
Joined: Wed Mar 07, 2012 8:42 pm
Contact: Website

Re: Stream audio from command line

Mon Jul 02, 2012 5:23 pm

I just started a topic on something similar look up cmus it may be what you want.

User avatar
nommo
Posts: 40
Joined: Sun Jun 10, 2012 10:17 am
Location: UK

Re: Stream audio from command line

Mon Jul 02, 2012 8:49 pm

Hi - I haven't tried the starting-up from boot part, but I've streamed successfully with omxplayer... bearing in mind you have omxplayer installed, try this:

From /home/pi make a script like:

Code: Select all

nano runradio.sh
type this command in nano and save it by pressing ctrl-x

Code: Select all

omxplayer -o hdmi server.address:port/directory 
Then make it executable? (I'm really a n00b at this stuff!)

Code: Select all

sudo chmod ugo+x runradio.sh
Make sure it runs ok

Code: Select all

./runradio.sh
Then add the script to /etc/rc.local

Code: Select all

sudo nano /etc/rc.local
This is where you may need help from someone who knows what they are doing.... :mrgreen:
I ate all the Pi

omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

Re: Stream audio from command line

Mon Jul 02, 2012 9:23 pm

Ok, thanks fir all info so far!
Get your Pi from here! http://bit.ly/18blVup

User avatar
nommo
Posts: 40
Joined: Sun Jun 10, 2012 10:17 am
Location: UK

Re: Stream audio from command line

Mon Jul 02, 2012 10:05 pm

One thing I've found with omxplayer is that it won't do playlists like .pls and .m3u which will be useful for audio streams.. (e.g. playlists often have alternative urls in case the first one doesn't work), you could add the same URL to your stream of choice loads of times and it should connect back up by playing the next URL in your playlist (the same stream in your case). For this reason you might fare better with one of the other media players like mplayer or vocal etc. Same principle applies for a startup script though..
I ate all the Pi

felixfurtak
Posts: 47
Joined: Wed Nov 16, 2011 10:41 am

Re: Stream audio from command line

Mon Jul 02, 2012 10:11 pm

mpd can do this. it's quite easy to set up

omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

Re: Stream audio from command line

Mon Jul 09, 2012 8:22 pm

Hi, can you help me out with installing mpd? I know it is basic stuff, but I haven't used linux before!

Thanks
Get your Pi from here! http://bit.ly/18blVup

omega1
Posts: 113
Joined: Mon Jul 02, 2012 3:10 pm
Location: UK
Contact: Website

Re: Stream audio from command line

Mon Jul 09, 2012 9:28 pm

Just managed to get omxplayer to install (linux isn't the easiest!)

I have also successfully got it to stream (even AAC works) so I am definitely getting somewhere...

I just need to try and follow the bit about getting it to run automatically from boot, I haven't gone through the steps above yet, but if anyone can contribute to running the following command on boot-up:

Code: Select all

omxplayer http://server:ip
Thansk in advance...
Get your Pi from here! http://bit.ly/18blVup

RMW5
Posts: 47
Joined: Fri Dec 23, 2011 4:31 pm

Re: Stream audio from command line

Tue Jul 10, 2012 12:28 pm

OMX player works with streaming mp3. Try this if you like cool French music and Parisian traffic reports:

omxplayer http://95.81.146.2/fip/all/fiphautdebit.mp3

Return to “Media centres”