In this article, I will show you how to host your own 24 hours free online radio station (web radio station) using a completely free open-source application and how to live stream the radio station to YouTube.
For that, I use the Azuracast online program. It is self-hosted and absolutely free. It has a number of features, including web-based station administration, which allows you to upload material, manage playlists, create local mount points and distant relays, check statistics and statistics, and more, all from the comfort of your web browser.
Another feature is Multi-Station Administration, which allows you to host several stations on a single installation. It features public pages built-in. Each station comes with a public-facing player page that can be incorporated onto your website right out of the box. You may use the APIs to create your own players and interfaces.
A Virtual Private Server is required to host that server. I’m using an Oracle cloud lifetime free VPS for this example. If you’re having trouble setting up an Oracle Cloud account, watch this video, which will walk you through the process.
Oracle cloud free tier gives a small VPS server then you unable to keep high quality HD streaming with that VPS. You can select powerful premium cheap VPS server, check these providers.
Create Oracle Cloud VM Instant (VPS)
After you sign-up to Oracle cloud, log in to the dashboard. Click the “Create VM Instance” button. Name your instance using any name you preferred. Under “Placement and Hardware” click the “Edit” button. then click the “change image” button to select an OS. In the given list, select Ubuntu 20.04 as your OS.
Under “Networking” click the “edit” button and make sure you select “create new virtual cloud network” and “create new public subnet”. Under “Add SSH key” chose the “paste public key” option.
Now, you have to generate SSH key pairs for that. Download the Putty app.
After downloading the app, Open Putty Gen to generate a new SSH key pair. Click the “generate” button and move the cursor in this area. After that, copy and paste the public key. Save your private key. It is necessary to connect the VPS using an SSH terminal.
Lastly, click the “Create” button to deploy the server. The server is now deploying. Let’s change add the firewall rules while the VPS is ready. Open your Subnet in the new tab. Click on your subnet ID. To add the new rule, click the button called “Add Ingress Rules”.
Add this for Source (0.0.0.0/0) and type 80 as destination port which allows HTTP traffic.
Add another rule by adding the same Source IP range (0.0.0.0/0) and 443 as destination port to allow HTTPS traffic.
Go back to the instance and you will see it is running now.To connect to the VPS via SSH, open the Putty terminal. Enter your Public IP address as the hostname. Under SSH click “Auth”, then add your private key file that was previously saved. Save the session, it helps you to connect the VPS without entering credentials.
Now Open the terminal and use “Ubuntu” as the login name.
Add Swap File to Increase the Memory of the Server
You can use the Swap file to increase the memory of the VPS. First, you can enter this command to check the available memory.
free -m
There is no Swap space yet in this server. Let’s add one. Create a swap file and allocate space. I’ve used 1024 MB but you can take more.
sudo dd if=/dev/zero of=/mnt/swap.0 bs=1024 count=1048576
Next use this line to mount it.
sudo mkswap /mnt/swap.0
Switch to the root account to activate the swap.
sudo su
Use this to activate it.
echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab
Next use this command.
swapon /mnt/swap.0
Check if it’s created successfully.
sudo swapon -s
Check again the created main and swap size for memory. The swap file is created successfully.
Get root access by typing this.
sudo -i
Update list of packages of Ubuntu.
sudo apt update
This command will upgrade the system. To continue, type “Y.” AzuraCast may now be installed on the server.
sudo apt upgrade
Install Azuracast Web Radio Management Interface
Reconnect to the VPS using SSH. Get root access first.
sudo su
Choose a base directory for AzuraCast to operate on your host machine. Create a dictionary with this command.
mkdir -p /var/azuracast
Use this to navigate it.
cd /var/azuracast
To get our Docker Utility Script, do these commands.
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/docker.sh > docker.sh
Set it as executable.
chmod a+x docker.sh
Finally, run the Docker installation process. Type “Y” to proceed. Type “Y” to install Docker Compose. We don’t have to install a stable version so click “N”. If you want to set SSL for your domain, you can proceed with this step but it is not necessary to us. So, I chose “N”. The installation process may be taking some time, wait until it finishes. You can enter into a web platform using public IP (http://your public IP).
./docker.sh install
Set up Azuracast Web Interface and Upload files
If you log in for to first time, you have to create a new account. Type your email and a password to create a new administrator account. Name your first radio station.
If you want you can customize other settings as well. I use default settings. After clicking the “Save Changes” button to proceed further. In here, tick marks these two boxes and finish the set-up. Now your web radio station is ready. You can upload the songs and create a playlist.
You can manage the single radio station settings here. Under the “Music file” section You can upload the songs.
Setting up Azuracast & Start Broadcasting
You have to upload music files that you want to broadcast but they are should be copyright-free, otherwise, YouTube taken down your live stream.
After uploading your music files, click the “Start Station” button at the left upper corner of the Azuracast dashboard. It is started now; you can check it using the link at the top right corner. Also, you can see the public page using these links.
Install FFmpeg Video Encoder
Using the Putty app connect to the terminal again. This time, you able to use the saved session to connect the VPS without entering credentials. Login as “Ubuntu”.
Install FFmpeg video encoder using this command. Here type “Y” to proceed further.
sudo apt install ffmpeg
FFmpeg is a free and open-source software project that includes a vast collection of libraries and tools for working with video, audio, and other multimedia files and streams. It is used to broadcast the Azuracast radio station live to YouTube. The installation procedure takes some time, so please be patient and wait till it is completed.
Now we need to add an extra screen to keep the process running once the SSH connection is closed.
sudo apt-get install screen
Upload Video/Image file to VPS using FileZilla
Download FileZilla Application
You have to upload a loop video or image. It is the background of the live stream and it loops during the Azuracast audio broadcast.
I use the FileZilla FTP client to upload the video file to the server. You can download it using the link in the article.
After installation of the FileZilla, open the application and click the server icon at the top corner to connect the server. Add a new site and name it using any name you preferred. Paste your public IP address of the server as Hostname and enter “22” as the port.
Change the protocol to “SFTP” and also select Longo Type as “Key File”. Enter user name “Ubuntu”, then select the private key file that you previously saved. It is the same file that use to connect the Putty terminal. After setup, click the “connect” button, which will establish the connection between server and client.
The window on the left-hand side is your local computer and on the right-hand side the remote server. To upload the file, simply right-click on the file and select upload. You will see the progress below.
When finish the upload, copy the name of the file and location. This is the script that use to broadcast the Azuracast on YouTube. Please replace the below locations that indicate in Red with your own credentials.
#! /bin/bash
VBR="1500k"
FPS="24"
QUAL="superfast"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
KEY="bxts-x2xm-rjr6-ux74-2xys"
VIDEO_SOURCE="/home/ubuntu/evolux.mp4"
AUDIO_SOURCE="http://188.121.1.261:8000/radio.mp3"
ffmpeg \
-re -f lavfi -i "movie=filename=$VIDEO_SOURCE:loop=0, setpts=N/(FRAME_RATE*TB)" \
-thread_queue_size 512 -i "$AUDIO_SOURCE" \
-map 0:v:0 -map 1:a:0 \
-map_metadata:g 1:g \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \
-f flv "$YOUTUBE_URL/$KEY"
Live Stream Radio on YouTube
Now connect to the server terminal again using the Putty app. Use this code to get a new screen. The new screen keeps the live stream after the termination of the SSH connection with the server.
screen
Get your Azuracast broadcasting URL and replace it in the script. Now copy the code and paste it in the terminal, after press “enter” to run it. You can see it is running now. Check it on your YouTube live stream dashboard. You can see it is successfully broadcasting on YouTube.
Please enjoy your Live Radio Station. Thank You.
[…] 24/7 on air. You can promote it as a small business or monetize it with advertisements. Check our online radio station setup […]
my stream automatically stopped after 22hrs ffmpeg showed some broken pipe error !
Can you please help me out ?
my stream automatically ended due to no input from the server
in my vps ffmpeg was showing broken pipe error :/
Hello
I have tried to install Azuracast following this guied line more than six time each time creating fresh VM Instance . but I face the same error . see this and help me to install this
Docker Compose does not appear to be installed. Install Docker Compose now? [Y/n] Y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 665 100 665 0 0 9637 0 –:–:– –:–:– –:–:– 9637
100 2884k 100 2884k 0 0 17.0M 0 –:–:– –:–:– –:–:– 17.0M
Prefer stable release versions of AzuraCast? [y/N] N
./docker.sh: line 356: docker-compose: command not found
./docker.sh: line 357: docker-compose: command not found
./docker.sh: line 404: docker-compose: command not found
./docker.sh: line 405: docker-compose: command not found
./docker.sh: line 406: docker-compose: command not found
[email protected]:/var/azuracast#
[…] “exit” to logout from the root user. For live streaming using Linux, you have to install the FFmpeg video encoder. FFmpeg uses for manipulations with audio and video […]
Mine tuts i dont have any credit card or debit card
I cant sign to oracle
Help me pleassssseee