Run a 24/7 Study With Me Stream from a VPS
This guide walks you through setting up a 24/7 “study with me” live stream on a Virtual Private Server (VPS). You’ll get a stable, always-on stream that doesn’t depend on your personal computer being awake. You’ll need a VPS with at least 2 GB RAM, a basic understanding of the command line, and a free OBS Studio install on your local machine for initial setup.
What You’ll Need
- A VPS (Ubuntu 22.04 or 24.04 recommended) with at least 2 GB RAM and 2 vCPUs.
- SSH access to the VPS (root or a user with sudo).
- A streaming platform account (YouTube, Twitch, etc.) and your stream key.
- OBS Studio installed on your local computer (for the initial scene setup).
- Basic comfort with terminal commands.
Step-by-Step
- Prepare your VPS – SSH into your VPS and update the system:
sudo apt update && sudo apt upgrade -y. Create a non-root user if you haven’t already. - Install FFmpeg – FFmpeg will handle the video encoding and streaming. Install it with
sudo apt install ffmpeg -y. - Install OBS Studio on your local machine – You’ll use OBS to design your scene (camera, timer, background, etc.) and export the scene layout. Download OBS from the official website and install it.
- Create your scene locally – Open OBS, add your sources (webcam, screen capture, images, a countdown timer). Arrange them as you want. This is what your stream will look like.
- Export the scene as a collection – In OBS, go to Scene Collection > Export. Save the JSON file. This file contains your scene layout but not the actual media files (like images or video).
- Upload your media files – Transfer any images, videos, or audio you use to the VPS. Use SCP:
scp /path/to/file user@your-vps-ip:/home/user/stream/. - Install OBS Studio on the VPS – OBS can run headless on Linux with virtual display. Install it with
sudo apt install obs-studio -y(or use the PPA for the latest version). - Set up a virtual display – OBS needs a display. Install Xvfb:
sudo apt install xvfb -y. Then start a virtual display:Xvfb :99 -screen 0 1920x1080x24 &. - Configure OBS on the VPS – Run OBS with the virtual display:
DISPLAY=:99 obs-studio --headless. This creates a default profile. You’ll need to edit the profile files to match your stream settings. - Import your scene collection – Copy the JSON file you exported to the VPS and place it in the OBS config directory:
~/.config/obs-studio/basic/scenes/. Also copy the media files to the same paths as in the JSON (or edit the JSON to match the VPS paths). - Set your stream key – In the OBS config file
~/.config/obs-studio/basic/profiles/<profile>/service.json, add your stream key and server URL. You can also use the command line:obs-studio --streamwith the key in the config. - Start the stream – Run OBS with the virtual display and your profile:
DISPLAY=:99 obs-studio --headless --profile <profile> --scene <scene>. Test that the stream is live on your platform. - Automate with systemd – Create a systemd service to keep OBS running. Create a file
/etc/systemd/system/obs-stream.servicewith the command, then enable it:sudo systemctl enable obs-streamand start it. - Monitor and maintain – Check logs with
journalctl -u obs-stream. Set up a cron job to restart the service if it crashes.
Common Mistakes
- Not updating the VPS before installing packages, leading to dependency issues.
- Forgetting to set the DISPLAY variable when running OBS headless.
- Using absolute paths in the scene JSON that don’t exist on the VPS.
- Not opening the correct port in the firewall (though OBS uses outbound connections, some platforms require a specific port for RTMP).
- Running OBS as root without proper config permissions.
- Not testing the stream before scheduling it to run 24/7.
Tips
- Use a lightweight scene – avoid heavy animations or high-resolution video loops to reduce CPU usage.
- Set a reasonable bitrate (e.g., 2500-4000 kbps for 1080p) to avoid buffering for viewers.
- Use a timer that automatically resets (like a countdown loop) to avoid manual intervention.
- Schedule the stream to start and stop automatically using cron or systemd timers if you want breaks.
- Keep a backup of your scene JSON and media files on GitHub or a local drive.
- Monitor your VPS CPU usage with
htopto ensure it’s not overloaded.
Troubleshooting
- Stream not starting – Check the OBS logs (
journalctl -u obs-stream). Verify your stream key is correct and that the server URL matches your platform’s RTMP endpoint. - Black screen on stream – Ensure your scene sources are correctly referenced. If using a webcam, make sure the device is available on the VPS (you may need to use a virtual camera or a video file instead).
- OBS crashes on startup – Usually a config issue. Delete the OBS config directory and start fresh, then re-import your scene.
- High CPU usage – Reduce the output resolution or frame rate. Use the “ultrafast” x264 preset via the OBS advanced settings.
- Stream disconnects randomly – Check network stability of your VPS. Increase the “output buffer” and “max bitrate” in OBS settings to handle spikes.
- Virtual display not working – Make sure Xvfb is running and the DISPLAY variable is set correctly. Test with
xrandrunder the display.
Frequently Asked Questions
Can I use a free VPS for this?
Some providers offer free tiers (e.g., Oracle Cloud Free Tier), but they may have limited resources. A 2 GB RAM VPS is the minimum for a stable stream.
Do I need OBS on my local machine?
Only for the initial scene setup. Once you export the scene collection, you can delete OBS locally.
Can I use a pre-recorded video instead of a live webcam?
Yes, you can add a video file as a source in OBS. The stream will loop the video, which is common for study streams.
How much bandwidth does a 24/7 stream use?
At 3000 kbps, it’s about 1.3 GB per hour, or roughly 31 GB per day. Check your VPS’s bandwidth limits.
Can I schedule the stream to start and stop automatically?
Yes, you can use systemd timers or cron jobs to start/stop the OBS service at specific times.
Is it against platform rules to run a 24/7 stream?
Most platforms allow it, but check their terms. Some may require you to be interactive or may flag constant streams as non-original content.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.