How to broadcast any radio station to Youtube using FFmpeg

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.

Getting started

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.

Installing FFmpeg

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:

The last command should output something like this:

Checking the FFmpeg version
Checking the FFmpeg version

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 You only need to copy and paste it:

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”:

Live streaming on Youtube
Live streaming on Youtube

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):

Live Dashboard of stream on Youtube
Live Dashboard of the stream on Youtube

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:

Output of the script
The output of the script

In parallel with this, you can listen to some music in the live-dashboard:

The radio-stream is live on YT
The radio-stream is live on YT

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!