Hello! In this tutorial, you will learn how to live stream to YouTube using a free VPS without OBS or GPU. OBS does not support free VPSs that do not have a GPU.
You do not have to open your PC for a long time during the live stream and are able to keep an excellent connection with the YouTube server for YouTube unlisted live stream.
Step-up Free VPS on Oracle
I used the Oracle free tier for this tutorial. It is a free VPS. You can get two free VPS from Oracle’s cloud. Only you need to sign up for Oracle Cloud. If you have trouble with registration, watch the first part of this video. After registration, you can continue other steps.
The Oracle Cloud Free Tier gives you a small VPS server, and you are unable to keep high-quality HD streaming on that VPS. You can select a powerful, premium, cheap VPS server; check out these providers.
In your Oracle dashboard, click the “create a VM instance” button.
Name it, and use any name you prefer. Click “edit” under “configure and placement hardware“.
To change the OS, click the “change image” button and select Ubuntu 18.04 as your OS. Under network configuration, check whether you select “New virtual cloud network”.
You have to add an SSH key for the instance. Select “paste public key” to add the SSH key. You have to install Putty Key App to generate and connect to the VPS.
Check the description for the download link. After installation of the Putty app, open Putty Keygen. Click the “Generate” button, then move your cursor to this area.
Copy the SSH key and paste it. Click the “create” button to deploy the VM instance. It may take a few seconds. Save the private key in a safe place, it is necessary to connect the VM instance. You can see here, VPS is running.
Add Swap Space to Increase RAM
Copy the public IP address of the VPS. Open the Putty app and paste the public IP address as the hostname. Under SSH, click Auth to add the private key that you previously saved.
Now go back to the “session” tab and save your session using any name. Then you are able to connect it again without entering credentials again. Click open to enter the terminal window. Type “ubuntu” to log in to the virtual machine.
We have to add more memory to the VPS before starting the live stream. It helps to keep a smooth stream going.
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.
Use this to activate it.
echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab
Next, use this command.
Check if it’s created successfully.
sudo swapon -s
Check the memory’s main and swap sizes again. The swap file was created successfully.
Install FFmpeg Video Encoder on VPS
Type “exit” to log out as the root user. For live streaming using Linux, you have to install the FFmpeg video encoder. FFmpeg manipulates audio and video using command-line tools. Then we don’t want OBS Studio to broadcast.
Follow these commands one by one to install FFmpeg. First, use this to install the repository.
sudo add-apt-repository ppa:mc3man/trusty-media
Update the list of packages on your VPS using this code.
sudo apt-get update
Install FFmpeg using this command. Type “Y” to proceed.
sudo apt-get install ffmpeg
Once you use this command, you should see the result like this. It indicates the successful installation of the encoder.
Upload files using SFTP FileZilla
You have to upload video and audio files using the SFTP client. I use FileZilla for this. You have to download and install this application before this step.
After installation, open the FileZilla client. Click the “server icon” at the top left corner. Then click the “new site” button to add a new server. Paste your public IP address as the host and 22 as the port. Change the protocol to SFTP, then change “Logging Type” to the key file.
Enter user “Ubuntu” and select your private key file that was saved before. After setting all of these, click the “connect” button to connect to the server.
Now, it is successfully connected to your remote server storage. In this application, the right-hand side is the remote server, and the left-hand side is your local machine.
On your local machine, select the file that you want to upload. Right-click on it and click “upload”. On the button, you can see the progress of the upload.
You can upload other files using this method. Copy the path to your file and paste it on the notepad. Then copy the file name and paste it at the end of the path that you copied. You have to do this with both video and audio files.
SCRIPT UPDATED FIX BUGS
#! /bin/bash VBR="1500k" FPS="24" QUAL="superfast" YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" KEY="z5k3-8888-69qu-9999" VIDEO_SOURCE="/home/ubuntu/live 2.mp4" AUDIO_SOURCE="/home/ubuntu/Music 5h.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"
After that, you can get this streaming script in the guide. Please check the description. Replace the video and audio paths with your paths. You must use your key to replace the stream key. You can find it on the YouTube live stream page of the channel.
Connect to your VPS again using the SSH terminal. Use this code to list the files in this directory. You will see the uploaded files here.
Run Stream Script and Live on YouTube
After that, you have a new screen. It helps keep the live stream up and running after the closing of the SSH terminal. Use this command to install the screen.
sudo apt-get install screen
Use this code to navigate your new screen. Press “Space Bar” to proceed.
Now paste your stream Script here and press “enter”.
Now your live stream has started. Visit the YouTube Live Stream Page to see it. You, Will, get an excellent connection with this. There is no need for a GPU or OBS to run live streams on YouTube.
Thank You. Have a good day. If you have anything comment below.