YouTube livestream radio from icecast based system on your own dedicated server or VPS.
I suggest you to use at least VPS with:
- 2 CPU (cores) 2GHz (the more the better)
- 8GB RAM (the more the better)
- 50GB disk space (should be fine)
System I have tested this out: Ubuntu 20.04 LTS
The easiest way to run your own radio on the dedicated server is to install AzuraCast.
mkdir -p /var/azuracast
cd /var/azuracast
then
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/docker.sh > docker.sh
chmod a+x docker.sh
./docker.sh install
you can also add Let's Encrypt SSL certificate
./docker.sh letsencrypt-create mydomain.example.com
You can use basic ffmpeg 3.x
First run update
sudo apt update
then install the application
sudo apt install ffmpeg
To install ffmpeg 4.x you can use snap
sudo snap install ffmpeg
Go to your youtube account and set the new live stream
# set the quality of your stream here
VBR="1500k"
FPS="24"
QUAL="superfast"
# youtube livestream settings
YOUTUBE_URL="rtmp://x.rtmp.youtube.com/live2"
KEY="KEY_OF_YOUR_STREAM"
You should be able to get your stream key from the active live stream on your Youtube Studio.
Just click on the eye icon to reveal it
...next
# point the script to your cover gif file
VIDEO_SOURCE="/PATH_TO/livestream_cover.gif"
# enter here the URL to your icecast MP3 stream
AUDIO_SOURCE="URL_OF_YOUR_MP3_STREAM"
...set font and the source of song titles
# set the font which will be used by ffmpeg
FONT="/PATH_TO/overpass-regular.ttf"
# set the path to song.txt file containing current song data
NP_SONG="/PATH_TO/song.txt"
Additional information concerning ffmpeg part of script (on the bottom of the file)
Here you can define the font size
fontsize=42
Here you can define font color, opacity and the text position
fontcolor=white@0.8: x=50: y=th
# define json from which you will take the current song title
SONG_TITLE=$(curl -s 'https://YOUR_AZURACAST_URL/api/nowplaying_static/NAME_OF_YOUR_RADIO.json' | jshon -e "now_playing" -e "song" -e "title")
Upload the file onto your server. It should be empty and writable.
DO NOT CHANGE THE NAME OF THE FILE - song.txt - LEAVE IT AS IS
Overpass font - overpass-regular.ttf
Youtube stream cover you can use - livestream_cover.gif