190 lines
7.7 KiB
Plaintext
190 lines
7.7 KiB
Plaintext
|
|
Episode: 4249
|
||
|
|
Title: HPR4249: Audio Streams on the Command Line
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4249/hpr4249.mp3
|
||
|
|
Transcribed: 2025-10-25 22:02:08
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
This is Hacker Public Radio Episode 4,149 for Thursday the 14th of November 2024.
|
||
|
|
Today's show is entitled, Audio Streams on the Command Line.
|
||
|
|
It is hosted by Kevvie and is about 8 minutes long.
|
||
|
|
It carries a clean flag.
|
||
|
|
The summary is, Kevvie talks about streaming
|
||
|
|
and ripping audio streams on Linux using the Command Line.
|
||
|
|
Hello, hello, this is Kevvie from the TuxJump podcast
|
||
|
|
and welcome to another episode of each PR.
|
||
|
|
Now, on this episode, I actually wish to go over two things here.
|
||
|
|
Firstly, streaming from the command line
|
||
|
|
and then secondly, ripping the stream or recording it,
|
||
|
|
depending what you want to call it, also from the command line.
|
||
|
|
Now, we seem to have gotten very used to huge programs
|
||
|
|
that will do everything for us and that's great,
|
||
|
|
but if you've maybe got a system with limited resources,
|
||
|
|
especially if you're on your travels and you've got your netbook
|
||
|
|
or laptop or whatever, then it may not be the same as having a big PC,
|
||
|
|
at desktop PC, so you're thinking, right,
|
||
|
|
you want to scan other limited resources a wee bit
|
||
|
|
and this is where the command line really helps
|
||
|
|
because instead of installing the graphical thing
|
||
|
|
which will do everything with bells and whistles,
|
||
|
|
instead, think of them with the command line tools
|
||
|
|
as being more they do one thing and usually do it well.
|
||
|
|
So for this, you don't actually, likely will not actually have
|
||
|
|
to install anything to use these.
|
||
|
|
You're just going to need an internet connection to actually stream
|
||
|
|
the radio or music, whichever it's going to be.
|
||
|
|
If you've got a pre-built Linux distro,
|
||
|
|
so if you're using something like Ubuntu or Linux Mint or whichever one,
|
||
|
|
chances are you'll have VLC installed.
|
||
|
|
Now, you can actually use VLC from the command line.
|
||
|
|
However, if you just type in VLC, it'll bring up the graphical,
|
||
|
|
but if you type in CVLC, then that is a purely command line driven one.
|
||
|
|
You will not get any GUI at all.
|
||
|
|
So let's just say, for example, you've got your stream.
|
||
|
|
It's as simple as CVLC space and then put in the address of the stream.
|
||
|
|
That's it. It's as simple as that.
|
||
|
|
It will play it and we'll keep on playing it until you
|
||
|
|
hit Ctrl C to close that.
|
||
|
|
And that's it.
|
||
|
|
However, the one thing I dislike about it is that it will just
|
||
|
|
purely play this thing, but I won't give you any information.
|
||
|
|
So let's just say, for example, you're listening to a radio station.
|
||
|
|
It's a radio station.
|
||
|
|
You've got this stream on and you think, oh, that's a really good track.
|
||
|
|
What is it?
|
||
|
|
Well, if you're using VLC on the command line,
|
||
|
|
it doesn't actually tell you that by default.
|
||
|
|
So there's one way program that I like.
|
||
|
|
And I know I said that I wouldn't be downloading,
|
||
|
|
but this is a small program and it doesn't require many dependencies.
|
||
|
|
And this is just MPG123.
|
||
|
|
Now you may think, okay, so hot.
|
||
|
|
Well, with MPG123, once you install it,
|
||
|
|
all you do is literally type that in MPG123 space and then this stream.
|
||
|
|
And the only difference is that it'll continue playing,
|
||
|
|
but when each track is updated, or sometimes, you know,
|
||
|
|
these radio streams may be only tell you what show is on.
|
||
|
|
It's up to you.
|
||
|
|
It's up to them, sorry.
|
||
|
|
What they'll do is it'll display the title.
|
||
|
|
Now, from the majority of times, I've used a few kind of smaller,
|
||
|
|
lesser-known radio streams for this.
|
||
|
|
It works for all the big ones.
|
||
|
|
So you would have, let's just say, for example,
|
||
|
|
you're going to run, if you're in the UK BBC Radio 1,
|
||
|
|
BBC Radio 2, all those things.
|
||
|
|
It works for that.
|
||
|
|
But I've run a few very much localized radio stations
|
||
|
|
that have, I've got the URL for us as well.
|
||
|
|
And it also worked.
|
||
|
|
And it gives you the track title and also the artist.
|
||
|
|
So that's a handy feature.
|
||
|
|
And I quite like that.
|
||
|
|
So that's MPG123.
|
||
|
|
Like I said, not a comprehensive review.
|
||
|
|
It does one thing and does one thing well.
|
||
|
|
But I really love it.
|
||
|
|
You just hit Ctrl C to actually finish it off.
|
||
|
|
If you want to go a wee bit further,
|
||
|
|
then you can use other things.
|
||
|
|
You certainly can pedal your radio stations
|
||
|
|
into a playlist and you can start doing it like that.
|
||
|
|
But I'm not going down that route just now.
|
||
|
|
Sorry, that's for VLC.
|
||
|
|
That's not for MPG123.
|
||
|
|
Now, if you're thinking at the same time as well,
|
||
|
|
well, yeah, quite like to record something.
|
||
|
|
That's fine.
|
||
|
|
You can also record.
|
||
|
|
Now, one thing I would recommend, especially on the command line,
|
||
|
|
is we're just going to record here.
|
||
|
|
So rather than load up your home directory
|
||
|
|
with a bunch of recordings,
|
||
|
|
I would recommend that you create a dedicated folder for that.
|
||
|
|
So create your folder, call it recordings.
|
||
|
|
See, whatever you want.
|
||
|
|
If you really want to go down the route
|
||
|
|
to doing it on the command line,
|
||
|
|
it is just MKDIR, make directory.
|
||
|
|
So MKDIR space recordings.
|
||
|
|
So fine, change into that CD space recordings.
|
||
|
|
And we're just going to need a simple tool.
|
||
|
|
We do not need to install anything for this.
|
||
|
|
We're just going to use the WGate command.
|
||
|
|
So to do this,
|
||
|
|
now what we're going to do is we're going to do WGate
|
||
|
|
and then a space
|
||
|
|
and then hyphen capital O.
|
||
|
|
And then a space and then call it whatever you want.
|
||
|
|
Now the beauty of WGate is that if you want,
|
||
|
|
you can save it as an MP3 file,
|
||
|
|
an org file, or a flag file.
|
||
|
|
That's the only three I've tried.
|
||
|
|
I haven't tested it out any other time.
|
||
|
|
I'm really used, any other,
|
||
|
|
to be perfectly honest.
|
||
|
|
So you can, then you can save it as a flag file.
|
||
|
|
Just be wary, right?
|
||
|
|
That you are only going to get the quality
|
||
|
|
of the original stream.
|
||
|
|
It's not going to improve the quality of a bad stream,
|
||
|
|
just because it's saving as a flag file.
|
||
|
|
But it does mean it's a lossless file edition.
|
||
|
|
If you want to edit this later.
|
||
|
|
So to do that,
|
||
|
|
sorry, you get WGate space hyphen capital O,
|
||
|
|
or uppercase O,
|
||
|
|
and then a space and then call it whatever you want.
|
||
|
|
So I'll just call it test1.flac.
|
||
|
|
And then a space and you need the inverted commas now
|
||
|
|
and put the stream inside the inverted commas
|
||
|
|
and press enter.
|
||
|
|
And that's literally it.
|
||
|
|
That's all you do.
|
||
|
|
If you want to close it,
|
||
|
|
yeah, click on the terminal and press control C
|
||
|
|
and it'll stop the recording at any point.
|
||
|
|
When you're doing it, I did notice,
|
||
|
|
if you look at it through GUI,
|
||
|
|
then very often the file is there,
|
||
|
|
but it's reading as zero bytes.
|
||
|
|
Until you close it,
|
||
|
|
it doesn't seem to look like it's doing anything,
|
||
|
|
but it actually is.
|
||
|
|
So yeah, so that's a simple retool.
|
||
|
|
You could easily, if you wanted to develop this a wee bit,
|
||
|
|
set this up as a cron job,
|
||
|
|
where you put it in as a time,
|
||
|
|
you could set it as to go for a specific time,
|
||
|
|
if there's like maybe a specific radio station
|
||
|
|
that you listen to your radio program
|
||
|
|
and you're gonna be away, just set up here.
|
||
|
|
This is a cron job to actually record the time you want
|
||
|
|
and for the length you want.
|
||
|
|
So yeah, because it's as,
|
||
|
|
you can make this as fancy or as simple as you want.
|
||
|
|
So yeah, it's a nice wee simple shoe there
|
||
|
|
on plain as radio stream from the terminal
|
||
|
|
and also recording a stream from the terminal.
|
||
|
|
If you've done this or if you've got alternatives,
|
||
|
|
please let me know, you can either obviously comment
|
||
|
|
or give a alternative, give a reply shoe if you want,
|
||
|
|
but yeah, I just think this is something that these days
|
||
|
|
sadly doesn't get enough love,
|
||
|
|
but I think this will definitely be a place for it.
|
||
|
|
So until next time,
|
||
|
|
Gio and please do consider supporting Hacker Public Radio,
|
||
|
|
spread the word and also contribute a show if you can.
|
||
|
|
Bye.
|
||
|
|
You have been listening to Hacker Public Radio
|
||
|
|
at Hacker Public Radio, doesn't work.
|
||
|
|
Today's show was contributed by a HBO listener
|
||
|
|
like yourself.
|
||
|
|
If you ever thought of recording podcasts,
|
||
|
|
then click on our contribute link to find out how easy it really is.
|
||
|
|
Hosting for HBR has been kindly provided by
|
||
|
|
and onsthost.com, the Internet Archive and our sims.net.
|
||
|
|
On the Sadois status, today's show is released
|
||
|
|
under Creative Commons,
|
||
|
|
Attribution 4.0 International License.
|