ThisCalculator

Everyday

Host a 24/7 Study Stream on an Indian VPS

Updated · Standard formula, shown below

This guide walks you through setting up a 24/7 study stream on an Indian VPS, so you can broadcast a live, always-on focus room without keeping your personal computer running. You’ll need a VPS with at least 1 GB RAM, a domain name (optional but recommended), and basic comfort with the command line. By the end, you’ll have a stream that runs on its own, even if you close your laptop.

What You’ll Need

  • An Indian VPS (any provider like Hostinger, DigitalOcean, or Vultr) with Ubuntu 22.04 or 24.04, at least 1 GB RAM and 25 GB storage.
  • A domain name pointing to your VPS (for a stable stream URL; you can use the IP directly if you skip this).
  • SSH client (Terminal on macOS/Linux, PuTTY on Windows).
  • OBS Studio installed on your local computer for initial setup and testing.
  • A Twitch, YouTube, or owncast account/channel to stream to.

Step-by-Step

  1. Provision your VPS – Choose an Indian region (e.g., Mumbai) for low latency to Indian viewers. Select Ubuntu 22.04 LTS. Note the root password and IP address.
  2. SSH into the server – Run ssh root@your_server_ip and enter the password. Update the system: apt update && apt upgrade -y.
  3. Create a non-root user – adduser streamer, then usermod -aG sudo streamer. Switch to that user: su - streamer. (Security best practice.)
  4. Install FFmpeg and dependencies – sudo apt install -y ffmpeg xvfb x11vnc build-essential. FFmpeg will handle video encoding.
  5. Set up a virtual display – Install Xvfb: sudo apt install -y xvfb. Start a virtual screen: Xvfb :99 -screen 0 1280x720x24 &. This creates a headless display for the stream.
  6. Install OBS Studio (headless) – Add the OBS repository: sudo add-apt-repository ppa:obsproject/obs-studio -y, then sudo apt update && sudo apt install obs-studio -y. OBS will run on the virtual display.
  7. Create a stream scene – You need a scene with a looping video or a static image. For a study stream, use a pre-recorded loop of a study room or a timer. Store the video file in ~/stream/video.mp4.
  8. Configure OBS headless – Create a file ~/stream/obs-config.json with your stream key and settings. Example (replace with your details):
    {
    "output": { "mode": "advanced", "stream": { "url": "rtmp://live.twitch.tv/app", "key": "YOUR_STREAM_KEY" } },
    "video": { "base_width": 1280, "base_height": 720, "fps_num": 30, "fps_den": 1 }
    }

    (For YouTube, use rtmp://a.rtmp.youtube.com/live2.)
  9. Create a startup script – Write ~/stream/start.sh with:
    #!/bin/bash
    export DISPLAY=:99
    Xvfb :99 -screen 0 1280x720x24 &
    sleep 2
    obs --headless --config ~/stream/obs-config.json --scene "Main" --startstreaming

    Make it executable: chmod +x ~/stream/start.sh.
  10. Test the stream manually – Run ~/stream/start.sh. Check your Twitch/YouTube dashboard to see if the stream goes live. If it does, stop it with pkill obs.
  11. Set up systemd service – Create /etc/systemd/system/study-stream.service with:
    [Unit]
    Description=24/7 Study Stream
    After=network.target

    [Service]
    User=streamer
    ExecStart=/home/streamer/stream/start.sh
    Restart=always
    RestartSec=10

    [Install]
    WantedBy=multi-user.target

    Enable and start: sudo systemctl enable study-stream and sudo systemctl start study-stream.

  12. Verify it stays up – Check status: systemctl status study-stream. It should show “active (running)”. The stream will now auto-restart if it crashes.
  13. Optional: Set up a custom domain with HTTPS – Install Nginx: sudo apt install nginx -y. Configure a reverse proxy for the stream URL if needed (for Owncast). For Twitch/YouTube, you don’t need this.

Common Mistakes

  • Using the wrong stream key – Double-check that you copied the key correctly from your streaming platform. A typo will cause connection errors.
  • Forgetting to set DISPLAY – OBS needs the virtual display variable. Without export DISPLAY=:99, it fails to launch.
  • Running as root – Some OBS versions refuse to run as root. Always use a non-root user.
  • Not enabling restart – If the service crashes, without Restart=always it won’t come back automatically.
  • Ignoring bandwidth – Streaming at 1080p uses ~4.5 Mbps upload. Indian VPS plans often have 1 Gbps ports, but check your plan’s fair usage policy.

Tips

  • Use a looped video – A pre-recorded study room loop with ambient sound is more engaging than a static image. Ensure the video file is small (under 500 MB) to avoid storage issues.
  • Add a live timer overlay – You can use OBS’s text source with a countdown timer script, but that requires more setup. Simpler: use a video of a timer from a free source.
  • Monitor resource usage – Run htop to check CPU/RAM. If it’s maxed out, reduce resolution to 720p or lower FPS.
  • Schedule restarts – To prevent memory leaks, add a cron job to restart the service daily: 0 4 * * * /usr/bin/systemctl restart study-stream.
  • Use a CDN for the stream – Twitch and YouTube handle distribution, so your VPS only needs to upload once. That’s efficient.

Troubleshooting

  • Stream doesn’t start – Check logs: journalctl -u study-stream -n 50. Look for “Failed to connect” – verify the stream URL and key. Also check if OBS is installed correctly: obs --version.
  • Stream goes offline after a few minutes – This often indicates a network issue or OBS crash. Check systemctl status study-stream – if it’s “failed”, see the logs. Increase RestartSec to 30 to avoid rapid restarts.
  • High CPU usage – If the VPS has only 1 vCPU, encoding may be too heavy. Reduce resolution to 720p and FPS to 30. You can also use hardware encoding if your provider offers GPU instances (rare in budget plans).
  • Black screen on stream – The video source may not be loading. Ensure the file path is correct and readable by the streamer user: ls -l ~/stream/video.mp4. Also verify that Xvfb is running: pgrep Xvfb.
  • Cannot access the VPS after setup – If you lock yourself out, use your provider’s web console to reset the root password or reboot.

Frequently Asked Questions

Q: Can I use a free VPS for this?
A: Free tiers often have limited bandwidth and CPU, which may not sustain a 24/7 stream. A paid Indian VPS starting around ₹300/month is more reliable.

Q: Do I need a domain name?
A: No, for Twitch/YouTube you just need the stream key. A domain is only necessary if you self-host with Owncast.

Q: How much bandwidth will this consume?
A: At 720p30, roughly 1.5 Mbps upload. Over a month, that’s about 500 GB. Most Indian VPS plans offer 1-2 TB, so it’s fine.

Q: Can I stream my own screen instead of a loop?
A: This setup is headless, so it only streams pre-recorded content. To stream your live screen, you’d need OBS on your local machine, not the VPS.

Q: What if my VPS provider blocks streaming?
A: Some providers have fair use policies. Check your terms. If blocked, consider a dedicated server or a provider that allows streaming.

Q: How do I stop the stream?
A: Run sudo systemctl stop study-stream. To disable it permanently: sudo systemctl disable study-stream.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.