Files
hpr-knowledge-base/hpr_transcripts/hpr1277.txt

371 lines
32 KiB
Plaintext
Raw Normal View History

Episode: 1277
Title: HPR1277: Icecast 102
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1277/hpr1277.mp3
Transcribed: 2025-10-17 22:50:15
---
This is Hacker Public Radio.
Hi everyone, this is Katsuh and this is Hacker Public Radio and this is the second part
in my ice cast series, many series.
Very many series, probably this is probably, I don't know, last or second of the last episode
in this series.
The continuation ice cast, so in the previous episode, if you'll recall, we set up ice cast,
the streaming server, the thing that creates the stream, the conduit through which all
data flows to your listeners.
And we also set up and configured and turned on the ice's streaming source, meaning
the thing, the application that takes a look at your hard drive, finds some music to play,
plays it into the conduit that ice cast has created for us.
We used ISIS, the original, for the MP3 stream, for all the users of non-free browsers and
media players, and then we set up the current ISIS application to handle an aug stream
for the people with modern and free browsers and media players.
We also generated a quick and dirty HTML5 web front end for all of our listeners so that
they can open their old familiar application, the web browser.
They can go to your site, whatever it may be, and they can click the play button, and
they get the music no matter what.
It doesn't matter if they're on the non-free browsers or the free browsers.
It'll just play your stream.
They will hear it on their computer.
They will be placated because they now are entertained.
It's quite easy when you think about it.
I've just summed it up in about a minute, and it doesn't really take that much effort
amazingly because it used to be one of the most puzzling things that computing ever had
to offer for me, but now I kind of understand it, or at least I understand how to set it
up.
What we're going to do today is take a look at some of the ways to manage your little internet
radio station, and we're also going to look at alternatives to the ISIS and ISIS solutions.
Note that there's anything wrong with the ISIS and ISIS solutions.
It is just that ISIS really does one thing, and it does it well, but it does one thing,
and that is it looks for something called playlist.txt in the designated folder, and it plays everything
that's listed there, and when it reaches the end, it stops playing, or it might loop around.
I don't remember.
But it's not a terribly dynamic system in terms of, I think it loops, I actually know
that I'm thinking about it.
It actually loops.
It quits if there's some weird error, like you're trying to play a PDF.
But yeah, anyway, point is, it's not the most dynamic thing, and there's weird things
like, let's say you have a playlist of, let's just say, three songs.
Maybe they're really long songs.
They're yes songs.
So there's three songs, and they're playing, and then you decide, well, I really only
want two songs, so you delete one of them.
Well now ISIS gets confused, because it thought there were three items in this playlist,
and so then it starts skipping around, getting the wrong song, thinking it's in a different
place.
So it's not the easiest thing to actually kind of dynamically create these playlists.
What I used to do was just concatenate, concatenate, concatenate, but that still makes it difficult
because if you mess up or if you accidentally, you know, if you take a line out of not
where you're currently playing, then you've thrown everything off, and it gets kind of messy.
It's also difficult to know where it is in the playlist.
There's no indicator, right?
It's just a text file, so it's hard to get kind of a status of, hey, ISIS, what song are
you on right now?
I mean, it's not impossible, but it's not the most fluid thing in the world.
So we're going to take a look at some of the alternatives.
We're also going to take a look at some of the shell scripts that I wrote to manage the
ISIS and ISIS-CC workflow, because it was working for me for a very long time.
I really enjoyed it.
I set up a little internet radio station and sat down and just generated a bunch of shell
scripts that would help me manage my playlists, my album directories, and a couple of other
things, and it worked really well, because I could SSHN from anywhere in the world.
I could make sure that my playlists were populated and stuff like that.
If I'd been a little bit more dedicated to the idea, I probably could have done even
more, like come up with scripts to calculate how much time this chunk of playlist would
last for, and all these other things.
But in the end, I decided not to use them, because I did need something a little bit
more, quote unquote, user-friendly, because I needed other people to take over when I wasn't
around.
So, I guess let's start with those shell scripts, because they're simple, and I'll include
them in the show notes, and they were working, as I said, for quite some time, but it was
totally working just fine for me until it didn't.
Okay, so there's a couple of different ones that I want to talk about, so we'll start
with the first one called laser tag.
Laser tag is a one-liner, pretty much, it's actually a little bit more than a one-liner,
but basically it's a one-liner, it was a script that I adapted from a one-line command
that I used, ID3, V2, 4, so that was a lot of numbers, but actually it wasn't, it was
ID3, V2, that's the program that I used.
So this was a tagger to, it would look in a directory that was named artist name underscore
album title, it would look in that directory, it would figure out what the album name was
from the second field in the directory name, it would figure out what the artist name
was from the first field, and then it would tag all of those songs by that artist and
that album, and also the song titles, so if the track titles were things like track1.org,
track2.org, then it would just tag the track title as basically the file name, track1,
track2, not very useful, but if they were named a little bit more logically like by the
song title, then it would tag the thing as titles, so I did that just to get metadata
so that the people's audio players and stuff could pick up on the metadata if they did
things like that, and a lot of them do, so you might want to go through and make sure
that all of your files are tagged, and that would be one way to do it.
Of course in order for that to work, you have to make sure that there are no spaces in
the song titles, so I generated a quick and dirty spacer tool, which is truly quick and
dirty, it's just a, again, sort of a one-liner, it's just for this title, said everything
with space, with an underscore, and then you're done, I probably could have done that
with TR, but I did it with said, I don't care, I regret nothing, and then the real winner
here I guess was the GenList, which is something to generate a small self-contained playlist
from a directory, so I would execute GenList against a directory that contained, I don't
know, let's say an album by the hormones, so you've got the hormones, you've got a live
at that moon dog in, it's one album by the hormones, so it's the hormones underscore, live
at moon dog cafe or whatever it's called, and then you can GenList that, and it generates
a list of all of the track titles in that directory, and of course it does it with full
path names, one title per line, and then you can generate another list from another directory,
and it concatenates it to that, and it concatenates the next one to that, so you're building this
long playlist, which you can then concatenate into the actual live on-air playlist.txt.
I also popped in a couple of station IDs between every directory, and I just, like I said,
concatenate concatenate concatenate, and that way ISIS is basically always playing this playlist.txt,
and before it gets to the bottom of that playlist.txt, I'm concatenating new albums in, so it keeps
going. At the time that I was managing this little internet radio station in this way, I'm still
doing the internet radio station, but at the time that I was doing it with these shell scripts,
I also had a new day list, which was going to move the current playlist.txt to an archive,
so that I would have a record of everything that played, and then it was going to move a fresh one
into place, into playlist.txt, and it would just keep going. I never really ironed that out,
because I never got, by the time I was at that stage, I just kind of figured that no one,
but me, was going to be able to ever actually use this, and I did want more people to be able
to become DJs, so that I didn't have to generate playlists every single day of the week for 365 days
a year. Eventually, I did abandon this, and again, that's why I'm going to go over some
of the alternatives, because there are a couple of really good ones out there, and I think the
probably the easiest one, possibly, I don't know, in my mind, it's kind of the, yeah, it's the
easiest and quickest, and yet it really, really does, it does work, is MPD, and this is a tip that
I got from Delwin, and Delwin, I know from like IRC, I know him from a technical conference,
and he's also the, someone who hosts the multimedia sprints for me, version 1 and version 2,
he's a great guy, he discovered somehow that MPD, a music player demon, I'm sure you've probably
heard of it, you've probably used it possibly, it's a really great little tool, a lot of people just
have it in their home, on a home server, MPD, it's just kind of their music server, and it's dreams,
and you can have all your little local network computers listening to that home server for,
for all of the music, so you've got your own little internet radio station in your, in your house,
in the latest editions, or latest versions of MPD, they're actually wired, they're already pre-programmed
to be able to talk to icecast as one of the output options, yeah, so now you don't have to just
stream MPD, you can use MPD to play music, and then to stream it out to icecast, meaning that
you get not only a great backend MPD, but you also get a really great set of front ends that have
been around for quite some time, so one of the front ends that I use is called, and this is a
great name, but it's N-C-N-P-C-P, so it's incurses music player C++, that's kind of how you have
to remember it, N-C-N-P-C-P, and it's an incurses front end to MPD, so you can SSH into the server,
running MPD, so in this case that would be your icecast streaming server, good SSH into it,
fire up N-C-N-P-C-P, and manage your playlists in a pretty darned familiar kind of model, like, oh,
here's your music library, here's a playlist that you can build up, and it's kind of very interactive
and very, very easy to use, and it avoids hacked together shell scripts like the ones that I was using.
It's also a little bit more user-friendly if you could swindle someone into going near
a terminal long enough to teach them N-C-N-P-C-P-P, I could see that really working for you,
if that's not going to work for you, there's another front end to this, and it's called G-M-P-C,
that's G as in G-T-K-M-P-C, like, music player, client, I guess, is probably what it stands for,
it's a really slick looking application as well, really easy to set up, again, if you've got MPD
installed and working, and streaming to icecast, then you can use G-M-P-C-2-Thin Interface with it,
it's a G-T-K application, so you install it on anything with a desktop, and people can sit down,
and it's a very, sort of, iTunes-E kind of model, you know, it's, again, your music library,
a bunch of playlists, you can build the playlists, move them into order, and people who can drag
and drop can use it, I mean, that's great. Most people can do that, they can kind of, they can
get that into their routine, so that's a really nice one as well. Okay, so enough talk, let's
figure out how to get this MPD thing installed in the first place. Again, MPD, it's easy to install
on most Linux and BSD distributions, all you do is do whatever you usually do to install software,
so on Slackware, I might go to Slackbuilds.org and download the package, I might use sport,
install MPD, on Debian, I'm sure it would be an aptitude install MPD, and on the door it would be
young install MPD, and so on. Okay, so now that it's installed again, you're left with the binary
executable, which won't work right now, out of the box, and you've got a bunch of configuration files.
Actually one, so the configuration files should ought to be in slash etc slash MPD.conf,
possibly MPD.conf.new, whatever, open it up in your favorite text editor and take a look at it.
This is a beast and it's not easy and it's going to go wrong the first time around. It's very
confusing and every distribution seems to do it a little bit differently, it is quite annoying.
However, I did an episode on MPD on my other show, the New World Order, so if you want to go over
and hunt for that, I'll try to find it and maybe put it in the show notes or something, but it does
exist, come to think of it, maybe it was for Hacker Public Radio, I really don't know, it's out
there somewhere, I'm sorry, I'll try to find it and put it in the show notes. For now, however,
we're going to kind of do a quick run through. So the first thing that you have to remember is that
MPD is not going to run as yourself, right? The user running MPD is not going to show up as
clatu or whoever you are. It's going to show up as something else, maybe nobody, no group,
maybe it'll be MPD user, I don't know, it kind of depends on your distribution, to be honest.
I think out of the box it's just nobody and no group. So that means that a lot of this stuff is
not going to be accessible to MPD unless, of course, it is. So you need to set things like the
music directory. And if you put the music directory in some place that no other user has access to,
then MPD is not going to work for you. The playlist directory needs to be placed in some
location that MPD would have access to that. So all of these things are things to keep in mind.
And in the configuration file, there are places that you can define what user and group MPD does
indeed run as. The default is for MPD to simply run as the current user, which is kind of weird,
because you don't really want MPD running as root, do you? So you should define that as the user
in the group, I think, again, by default at least on Slackware and that's generally not altered in
any way. So it's nobody and no group. And that works. It works fine. But just make sure that nobody
and no group are going to have access to wherever you have it logging everything and putting all of
its playlists and things like that. The port that MPD wants to listen on or run on is 6600. I've
never seen any reason to change that, but it is a good number to remember because you'll need
to reference it when you're using the front ends. They'll want to know what port to knock on
to sort of attach themselves to MPD. Okay. So the way that I handled all of this was that I put
the music directory in slash usr slash local slash share because pretty much everyone has access
to that, at least on my system. You can do it differently if you want. I did it that way
so that I knew that MPD would be able to access all of the different files. Again, by default,
they have its set in the configuration file so that everything goes into tilde slash music,
tilde slash dot MPD slash playlist, tilde slash dot MPD slash database. They somehow seem to
expect you to be running this as a normal user and I don't even think it lets you do that. It's
really quite bizarre. It's very frustrating, at least. It has been for me the past couple of times
I've set it up. I never quite understand the logic behind this configuration file, but it
exists and you just have to change it and you can change it. So you should. So the music directory,
I make user slash user slash local slash share slash whatever. I do it MPD and then I put stuff
into there, but you can do it however you want to and you'll want to make sure that the playlist
directory is there and that the DB file gets saved there and so on and so forth. Don't get too
fancy with this configuration file up front. The less you change, the less you'll have to troubleshoot
when it all goes horribly wrong and it will all go horribly wrong. Past issues that I've had were
that the database file suddenly, it just like when you first start MPD, it insists that the
database file is corrupt. I have no idea why or it won't create the database file and then you
create it and then it says it's corrupt. There's a lot of bizarre things about MPD that I don't
quite feel like I understand 100%. But it generally in the end does work for me, so give it a shot.
It might work out of the box for you. You might find it a lot simpler than I do. Maybe I'm just
not getting something. In order for you to be able to build playlists and interact with MPD,
the music playing demon, you need to be able to log in to the music playing demon. It's a demon,
so it's a server. It's a service running on your server on that computer. That means you'll be
able to get clients for your laptops, for your Android phones, for lots of different things,
and you can then log in to that server into the MPD instance and do cool things like rearrange
your playlists or stop it or fast forward or whatever. So in order to do that, obviously you
would want some level of authentication. So in the configuration file, look for the word
password and it will take you down to the permissions configuration block.
If it is setting, if it is set, it will require a password for authorization and then there are
two levels of permissions that they offer. So the password will be password at read, add,
comma, control, comma, admin. So that would be the big master password. And so you could
give that a good password, and you'd have to uncomment it and give it a good password.
And then the default permissions is just read, add, control, and admin, which is kind of a lot
for not ever having a password. So I'd be careful with that. But that is an option. So if you want
some people to be able to look at the current playlist, maybe add songs, maybe control the player,
maybe not do admin type of things, then you could change that around. So you have two levels of
different authentication types. One for those who have used a password to log in and one of those,
one for those who do not. The nice thing about this configuration file is that if you do a search
for icecast, it will take you down to this configuration block, for an example of a shout output
for streaming the icecast. It's all commented out by default, of course, but you can, you can
uncomment it. And then you've got, you've created an audio output. And the type is shout,
the encoding is awg. I think you can actually, I mean, I'm pretty sure it puts out MP3 as well.
I don't know that I've, yeah, I think I've tried it with that. I'd have to verify that.
The name you can set to whatever you want it to be. The host, of course, again, remember in the
last episode we set the icecast host name to local host. So you would keep that to local host here.
However, my friend Reggie, who you've probably heard on her hacker public radio episodes or her
own podcast called the meta cast, she said that one time she was installing this and instead of
local host, it just kind of demanded that it was 127.0.0.1. We looked at her Etsy host
file and local host was indeed mapped to 127.0.0.1. So we're not really even sure what that was all
about. So yeah, just a little bit of experimentation may be required, but don't be too afraid too soon.
The port, of course, is still 8,000 because we didn't change that in the icecast configuration.
And then the mount point that you want it to create. By default, it's mpd.org. I wouldn't keep it
that way. Personally, I'd just call it like slash org or something, but whatever you want. The
password is set to be hack me. It's not hack me now. It is purple llamas. Remember? Listen to the
previous episode if you don't remember any of this. This is all the icecast configuration back
again. Quality is 5.0. By default, you can set it to higher or lower. The bit rate is 128. I found
that at 128, I get buffering issues a lot. So I lowered that. I think to 96 and then possibly to 80,
I don't remember, but it was it was a lot lower. The format 4,416 bit, you can change that to 32,000.
If you want 16 bit, I don't know, whatever you think is best for your bandwidth. The protocol
is set to icecast 2 by default. You should probably keep it that way. The user you may or may not
have defined a different user. You probably didn't, so I wouldn't do anything with that. Then there's
other stuff that you can set, like the description and the URL and the genre and stuff like that. Again,
I wouldn't set too much of this up front. I would go with minimal changes, turn the thing on, see
if it's working. If it's not, you have less to troubleshoot and then try it again and see what
happens. As long as you've configured this sensibly and just keep remembering the things that
keep tripping me up are setting my music directory to some place that MPD cannot access, given that
it is running as no user, no group. Or I'm setting a log file to some place that MPD cannot write to.
Or weird things like the database file just doesn't want to work the first three times.
Or the localhost is set to localhost and set to 127.0.0.1 or something weird like that.
So I wouldn't, I would make sure that all of your settings in the MPD conf match the icecast.conf
and then try to start MPD as a demon, which is how it starts. So start MPD and it'll start running.
And at that point you should be able to point your browser or your media player to the name of
your server.com, colon 8000 slash org or whatever you called it. And you should hear everything in your
MPD playlist playing over an internet stream. The MPD playlist itself of course is something that
you'll want to build. And the way that you build that is with some kind of MPD front end.
I've already told you about two in CMPCP being the in-curses version or GMPC being the GTK version.
The GTK version is really nice. It's very user friendly. People will be able to use it.
The one tricky thing about it is it's really a client software. So when you launch the GTK
in the GTK music player client, you need to log in to the MPD instance on that computer.
Or if you're running GMPC on some other computer, you could log in remotely to the server that
is running MPD. So it's kind of even nicer that way. The way to do that is you go to the preferences
and you set all of the information in the preferences of GMPC to match your MPD instance on that server.
So the port would be 6600. The host name would be of course the IP address or whatever of that
server that you're logging into. Or it would be local host if that instance of GMPC or whatever is
is running on your on the same computer as icecast is. And then the password of course would
need to be whatever you set the password as in the authentication or the permission block in
the MPD configuration file. So get all that figured out and then you should be able to connect to
your MPD service and create playlists, queue things up, stop and start the songs and all the types
of kind of normal music player types of things that you would ever want to do. Simple enough, right?
And it really is. It's just once you have icecast set up as long as a player supports sending that
audio to icecast, you can stream anything with really minimal effort. I think the final touch
for your little internet radio station would be to be able to stream live. And that is done with
a tool called but broadcast using this tool. But is I wouldn't say languishing project but I would
say that there haven't been many updates to it. But so far that doesn't seem to have been a problem
at all. I couldn't find it as an installable option for Slackware so I built a Slack build for it
which you can find at slackermedia.info slash Slack builds. It's but.tar.gz. I think it also is
going to be posted eventually to slackbuilds.org. So if you're on Slackware and need an installer,
it now exists. And if you're on any other platform, your package people have probably already
hooked you up. So you can just install but the UTT broadcast using this tool. I have to admit I was
a little bit nervous about this program. I didn't I kind of understood that its purpose was to
take sound from my line in and then insert that sound into my ice cast stream. So I kind of I
got that. I just didn't know how it was going to all work. Like I had all these visions of having
to figure out what my line in port was and how to wire that to butt and then how to get butt over
to the ice cast thing. Believe me, it's a lot simpler than you'd think. But has a very simple
interface. It's not it's one window and it's got a settings button over on the right. Click the
settings button. It brings up a new settings window and you can now configure the thing. So the audio
device of course would be whatever you want your audio line in to be. By default it just goes here
your whatever your system default sound input is the default sound card as said by also mixer or
whatever you use. I could set it to my USB microphone if I wanted to. Whatever however I want to do
it that's that's the simple part I think. The server it gives you a drop down menu but if you
haven't added a server yet there won't be anything in that drop down menu so you click the add button
and then you can add your server there. It defaults to shout cast so click over to ice cast
and then you give it a name that isn't a user name that's a name for this server for your
little drop down menu of course that's that's what this name is. It's not that you're logging in
with a user name it's just the the name of the server so that if you have like five different
servers that you're going to be streaming to or something like that that that's what this would
be referencing. It's for your own reference. You give it the address of the server the port that
you want to connect to. So the server name of course would be localhost because you're on the
computer that is streaming this stuff otherwise I don't know how you're going to get a line into
ice cast so localhost would be the server name and then the port of course is 8000 the password
which of course if you'll recall is purple llamas yes that's very good and then the mount point
that you want to create probably for consistency sake you'd want to just call it slash mp3 or slash
aug but you could just as easily create something called you know live stream or live or whatever.
You can also add stream info like the name of the stream a description genre URL to send
people for more information that sort of thing and that's pretty much it for server settings.
You can then go over to stream the stream tab and set things like the bitrate again the default
is 128 but on you know if you don't have really great bandwidth you might want to knock about
down to 96 or 80 the sample rate by default is 44 100 I knock that down to 32 thousand myself
channel stereo codec either mp3 or aug whichever you whichever you're going for that's pretty much
it for that I think. Notice that there are also tabs for a tab for recording REC this means that
yes you can record everything on your computer as you are also streaming it so that way you have a
nice little record of everything that happened on your live show or whatever once all that's set
you click the connect button and it connects and you're good to go you're streaming live audio
so by now I think you're probably getting the idea right all of these modules or these plug-ins
or whatever you want to call them their sources for ice cast ice cast has been set in place it
exists all it's waiting for is some stream of data for it to deliver to the world via its
little pipeline that it's created so no matter what you're a source so if you're if you're but
you're you're you're a source so you use your source password you connect to 8000 you create
a mount point and you're streaming you're streaming live or if you're using mpd you're connecting
to the same place 8000 you're a source so you use your source password and that's it you start
mpd and now ice cast is spitting out mpd output if you're using ises or ises dash cc or whatever
it's the same idea it's all basically the same setup once you have ice cast in place and
understand that all it's requiring is input so that it can deliver content to the masses so
as simple as that I hope this all makes much more sense now than it did at the beginning
and I think I've pretty much exhausted all the possible topics at least that I know of
concerning ice cast this is a surprisingly lightweight solution I didn't really realize how
lightweight this was but I installed it on a Pentium 4 and I can't remember the
specs on that but I think it was only about a gigahertz it was a pinning for maybe gigahertz
with like two gigs of RAM and it's been running like a champ and I haven't really had any problems
with it I don't know how many listeners it could have supported it I got fairly high but I
I never really I wouldn't say I stress tested a whole lot but in terms of having a small group
of listeners it really was it did not require a lot of hardware on the other hand the the big
alternate solution that I've been playing around with as well called airtime which I heard about
through Alcon DK I forget how he says it check out episode 1166 anyway and airtime radio
automation it's a really slick package it's web based interface it's really nice people can
use it and they love it and it feels like a you know web 2.0 and very slick kind of interface
you'll like it but it's very very it's not lightweight I mean it requires a patchy it requires a
bunch of other stuff it basically requires devian or Ubuntu to even install it's a very sort of
messy package I think in the back on the on the back inside it seems to require a lot of particular
things to be set up in a very specific way but it is very cool and it's nice but it's not lightweight
it requires certainly a dual core and a fair amount of RAM like 4 to 8 gigs I think so
those are your two options I think in terms of the the different routes of managing a radio station
an internet radio station at least that I know of I shouldn't I shouldn't speak so authoritatively
I'm totally new to this but but those are two good options so episode 1166 for airtime and then of
course ice cast you've just heard about it and like again I have to thank k-wisher and
Delwin and Ruggie and someone else who told me about something I think I mentioned his name
earlier I don't remember now but yeah the point is this episode has been the cumulative effort
of a lot of different people and I'm only doing it on my own because I just my schedule has been
so crazy that I just decided to record some episodes because hey the episode count is always
low here at hacker public radio so submit a show become an expert on something and talk about it
or just talk about something cool and hacker related vaguely hacker related so thank you for
listening to this I hope this has helped it's been a fun journey for me to figure all this stuff
out so I don't know set set up a streaming server play music for people it's really fun thanks
talk to you later
you have been listening to hacker public radio at hacker public radio does our
we are a community podcast network that releases shows every weekday on day through Friday
today's show like all our shows was contributed by a hbr listener like yourself
if you ever consider recording a podcast then visit our website to find out how easy it really is
hacker public radio was founded by the digital dark pound and the economical and computer cloud
hbr is funded by the binary revolution at binref.com all binref projects are crowd
disponsored by linear pages from shared hosting to custom private clouds go to lunar pages.com
for all your hosting needs unless otherwise stasis today's show is released under a creative
commons attribution share a life lead us own license