In this simple post, I want to share with you about my previous side-project – how I broadcasted radio to Youtube using DigitalOcean and FFmpeg. I decided to try broadcast one of Creative Commons radio stations to Youtube. Running ahead – the radio-station worked on Youtube for 6 days and 24/7. Youtube banned it because one day was playing a music track with another license.
For this project, we will use the droplet on DigitalOcean with Ubuntu 18.04. You can read more about how to create a droplet in the official DO tutorial.
First of all, you need to install FFmpeg. FFmpeg uses for manipulations with audio and video as a command line tool. On Linux we can install it using the following commands:
$sudo add-apt-repository ppa:mc3man/trusty-media
$sudo apt-getinstall ffmpeg
The last command should output something like this:
Starting a project
Create a new folder for our project with a single shell executable file:
Further, you will find the already prepared code for main.sh. You only need to copy and paste it:
BITRATE="2500k"# Bitrate of the output video
FPS="30"# FPS video output
QUAL="medium"# FFMPEG quality preset
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"# Youtube RTMP base URL
SOURCE="http://126.96.36.199:5234/stream"# Radio Station
Line 6 – the URL of audio-stream what you want to broadcast. It’s easy for configuration, so you can try to experiment with the values.
Getting Stream key
In this section, we will get a Stream key for line 7 of the script. It’s a unique ID for our stream. Open Youtube using your account and go to “Live streaming”:
When you press “Stream now”, you will be taken to the live-dashboard for the next stream. Go to “Encoder setup”, copy “Stream key” and paste it to the script (line 7):
Also, don’t forget to add a nice picture on line 5.
Running a project
Finally, run the script in the command line:
The terminal should show something similar:
In parallel with this, you can listen to some music in the live-dashboard:
If you hear the radio-stream with music, you have done a good job! The stream will work until you exit from the command line.
In this tutorial, I showed you all my steps about how I broadcasted a radio station to Youtube. I ran it on VPS with Ubuntu v18.04.1 x64. For VPS I used a DigitalOcean. If you have no Digitalocean account, you can sign up with my referral link ( it gives you 100$ of credit for 60 days).
I plan to create the video version of this tutorial, so will be grateful if you subscribe to my Youtube channel.
If you liked this, please help spread the word by hitting the recommend button below. Thanks!