Stream music, podcasts, or any other audio!
This software makes streaming easy. With this small collection of apps for Linux by Ron Spain, you can easily stream your music collection to any and every device on your LAN. And if you set up port forwarding on your router, you can also stream to any device on the internet.
You can stream from any computer capable of running Linux. Consider using an old computer or maybe a Raspberry Pi to stream your audio. Linux is free to install and use, and it makes your old computers work like new. You can even boot Linux from a USB without installing it. You have no reason not to set up a radio stream.
This software requires VLC, which is a free and open source media player with streaming capability.
For legal reasons, you should probably only broadcast content that you own the rights to use, especially if you're streaming high quality audio and your stream actually has listeners. But you can 100% legally stream any music that you've purchased to your own devices for personal purposes.
Song names should not contain brackets or other unusual characters.
This software causes your computer to transcode every track before it is played. For maximum efficiency, you should really transcode all the files beforehand and use VLC differently from the way it's currently used by this software.
In the near future, I'll include tools for bulk transcoding of audio files, checking of the filenames, and more.
The default settings should be sufficient for most users, offering good quality at a low bitrate, allowing you to have a large number of listeners. Use a higher sample rate and higher bitrate for more quality. Use a lower bitrate to reduce bandwidth or increase listener slots. A lower bitrate often requires a lower sample rate to sound okay, because any sample rate requires a minimum bitrate to avoid sounding tinny, underwater, or otherwise distorted. Broadcasting in mono can reduce the bandwidth required to provide good quality, as you have only one channel to reproduce instead of two, though I'm not sure that the bandwidth required for mono is half of that required for stereo. It isn't the case in FM radio. I assume more like 60 or 70%, but I haven't done the tests or studied audio codecs enough.
The sample rate determines the highest frequencies that are reproduced. A sample rate of 32000 samples per second can reproduce frequencies up to 16000 Hz, which is good enough for most people's hearing range. A CD-quality sample rate of 44100 allows reproducing of frequencies up to 22050 Hz. A sample rate of 16000 or less can be used with voice streaming. The original telephone system was designed to reproduce frequencies only up to 3400 Hz, which would be equivalent to a sample rate of only 6800 samples per second. A sample rate of 8000 or less doesn't sound great, but it works.
The bitrate determines how well the audio channels will be reproduced. You want to use the lowest bitrate that provides the desired quality. As mentioned, stereo requires more bitrate than mono, and higher sample rates require more bitrate.
Some codecs may only allow certain sample rates or bitrates.
For CD quality, use a sample rate of 44100 and a high bitrate. CDs are in stereo, of course. CD is uncompressed, so lossy compressed audio will never be as good, but a bitrate of 128 kpbs is usually considered adequate for streams with a sample rate of 44100. Bitrates of 192, 256, or 320 are sometimes seen.
The address to listen to a stream that is streaming from your own computer is http://127.0.0.1:8000/, replacing the port number 8000 with whichever port you choose. The 127.0.0.1 part means "this computer". To listen on your LAN, use an address like http://192.168.0.10:8000, replacing the 192.168.0.10 part with the LAN address of the machine that is streaming.
To listen from the internet/WAN, set up port forwarding on your router, and the address to listen is your IP address or domain name followed by a colon and the port number. Don't forget the http:// at the beginning.
With many routers, you can't use your WAN address or domain name to listen from the LAN. You must use the LAN address to listen on the LAN.
The included stream.sh shell script is what I've used for streaming for years with args so you can use the options you want.
./stream.sh "/music/directory" port container codec channels samplerate bitrate
To stream MP3 stereo at FM radio quality:
./stream.sh "~/Music" 8000 dummy mp3 2 32000 64
To stream AAC stereo at FM radio quality:
./stream.sh "~/Music" 8000 ts aac 2 32000 64
To stream MP3 stereo at a higher, near-CD quality:
./stream.sh "~/Music" 8000 dummy mp3 2 44100 128
To stream AAC stereo at near-CD quality:
./stream.sh "~/Music" 8000 ts aac 2 44100 128
To stream MP3 mono at lower quality:
./stream.sh "~/Music" 8000 dummy mp3 1 22050 32
This package includes Clumpy, a program that uses a simple genetic algorithm to make playlists clumpy, meaning it clumps together audio tracks that contain the same words, meaning it's a playlist derandomizer, making playlists more interesting than those that are purely randomly generated. It also allows you to randomly omit certain tracks if you find they're playing too often.
Clumpy is utilized automatically by the stream.sh shell script if it's present.
This package includes a tool for mirroring a stream. If you have a lot of listeners or are streaming from slow hardware, you could get your friends to mirror your stream. If you have multiple sources, you could have each source listed in an m3u playlist, so if one source doesn't work for whatever reason, an audio player will connect to another one. It may be beneficial to shuffle them so the order is random.
What are your options for streaming? Shoutcast is commercial. Maybe there's a free plan? Icecast is free and open source, so I installed it, but it seemed overly complicated, so I decided to stick with VLC for streaming. However, it's hard to find much information about streaming with VLC.
I want to see more streaming out there, and I want people to have more freedom online, so I'm sharing this software for free. I'll also share what I know about VLC to that end.
To stream in stereo at a sample rate of 32000 and bitrate of 64 kilobits per second using the MP3 codec:
cvlc playlist.m3u --sout "#transcode{
To stream with the AAC codec at the same settings:
cvlc playlist.m3u --sout "#transcode{
It's an ugly command line. The --no-sout-all means no output. The --sout-keep keeps the stream open. The -L causes vlc to loop the playlist, repeating from the beginning when it ends instead of quitting. The & at the end causes it to run in the background, so the terminal can be used for other things, though you might normally see warnings or error messages occasionally appear in that terminal.
You can run disown -h to detach the process from the terminal so it doesn't quit if you close the terminal.
You might also want to boost the priority of the streaming vlc process so it is allowed to serve listeners without waiting for other processes in the computer that aren't time-critical, thus avoiding problems for users with the stream skipping or quitting.
The playlist will loop forever, but you first need a playlist file named playlist.m3u. To generate that, cd on over to your music folder and dispatch this command:
The file list generated by the ls command is piped to sort -R in order to randomize or shuffle the playlist so it isn't the same every time. The 2>/dev/null part prevents error messages or warnings, such as when it can't find a particular file type. The result is saved to the playlist.m3u file. Now you have a playlist to stream.
Avoid all of these command lines and just use my Stream.py program.
You can live stream from your microphone like this:
cvlc -vvv "alsa://plughw:0,0" --sout "#transcode{
With that command, you can broadcast your own live radio show or live music performances. You only need to understand the port forwarding settings in your router in order to broadcast on the web. Or maybe just install miniupnpc if it isn't present in your Linux by default.
No ads, spyware, malware, trial periods, registration, etc.
The zip file is fewer bytes than this page, so just download it already.
Learn more about VLC at the VLC website.
sudo renice -10 $(pgrep vlc)
ls *.mp3 *.wav *.webm *.m4a *.mp4 *.flac \
2>/dev/null | sort -R > playlist.m3u
Live Streaming from Mic
Package Contents
Stream.py GUI for streaming, coded in Python 3 using tkinter Mirror.py GUI for mirroring a stream clumpy.c C source code for playlist clumpifier, compile via setup.sh setup.sh Linux shell script to help with using the software stream.sh Linux shell script for streaming via args menu.sh Linux shell script for streaming via menu
Page generated in 0.007052 seconds.