DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
DocumentaryTube
Admit one · Blog

How to Use a Linux VPS for a Continuous Pre-Recorded YouTube Stream

A practical guide to running a continuous pre-recorded YouTube Live stream from a Linux VPS with FFmpeg, including setup, bitrate choices, key security, monitoring, and troubleshooting.
Opened Runtime8 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run a pre-recorded YouTube Live stream from a Linux VPS by uploading your video to the server, sending it to YouTube with FFmpeg, and supervising the encoder so it can be restarted or monitored if it fails. YouTube does not require a VPS or endorse a particular FFmpeg recipe: this is a self-managed implementation. Your channel must be eligible to stream, and the VPS must have enough sustained outbound bandwidth for the video bitrate.

Before you start

Have a YouTube channel that is currently eligible for live streaming, a video you have the rights to use, a Linux VPS with sufficient storage and sustained upload capacity, and FFmpeg installed. A VPS keeps the encoding process off your home computer, but you remain responsible for the server, file, network connection, and recovery plan.

  • Check eligibility: YouTube says the channel must be verified, have no live-streaming restriction in the previous 90 days, and belong to a user at least 16 years old. A VPS cannot bypass an account restriction.
  • Check the video: Decide whether its codecs and timing can be sent as-is or whether FFmpeg must transcode it. Do not assume every media file is compatible with YouTube ingest.
  • Check capacity: Estimate required upload traffic from your output bitrate and the number of hours you intend to stream. Confirm the VPS plan’s transfer allowance and network terms; there is no universally suitable VPS size or provider.
  • Protect your stream key: Treat it like a password. Do not put it in a public repository, screenshot, or shared log.

Create the YouTube live stream

  1. Open YouTube Studio and go to Live Control Room. Create or select the stream you intend to use.
  2. Copy the server URL and stream key shown for that stream. YouTube Help instructs creators to enter the Live server URL and stream key in their encoder.
  3. Use the actual ingest endpoint shown in Live Control Room rather than a copied sample URL. YouTube recommends RTMPS, its encrypted RTMP-over-SSL/TLS option; its developer ingest guidance specifies an RTMPS endpoint using port 443.
  4. Keep Live Control Room available to check the incoming preview and stream health after starting FFmpeg. Use the applicable Live Control Room control to start the public broadcast.

The stream key is a credential. If it is exposed, replace it in YouTube Studio and update the VPS configuration before starting again.

Upload the video and prepare the VPS

The following example assumes a Debian- or Ubuntu-based VPS with sudo access. Package names and setup steps can differ on other distributions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  1. Install FFmpeg using the package manager for your distribution. On Debian or Ubuntu, run sudo apt update, then sudo apt install ffmpeg.
  2. Transfer your video to a directory owned by the account that will run the stream, using a transfer method you control. Confirm the file is complete and that the server has enough free storage for it and any logs.
  3. Inspect the file with ffprobe /path/to/video.mp4. Check its video and audio streams, resolution, frame rate, and codecs. If the media is already compatible, stream-copying may reduce CPU use; if not, transcode to settings that match the source and YouTube guidance.
  4. Create a restricted service account or use an existing non-root account to run FFmpeg. Store credentials in a root- or service-account-readable configuration file with restrictive permissions, not in a public script. For example, a protected environment file can hold the ingest URL and key; ensure the file is not world-readable and is excluded from backups or repositories that are not private.

Choose bitrate, resolution, and keyframe settings

YouTube’s current encoder guidance recommends constant bitrate (CBR), a two-second keyframe interval and no more than four seconds between keyframes. Its settings page recommends 17 Mbps video for H.264 at 1080p60. These are platform recommendations, not a guarantee of viewer quality; the output must also fit your source material and the VPS’s sustained upload capacity.

  • Resolution and frame rate: Match the source where practical. A lower resolution or frame rate can lower bandwidth and compute requirements. Upscaling a smaller source does not add detail.
  • Video bitrate: For H.264 1080p60, YouTube’s listed recommendation is 17 Mbps. Choose a sustainable rate for your VPS connection and transfer allowance; a rate that exceeds available upload capacity can cause dropped frames or disconnects.
  • Keyframes: Set a two-second interval. For 60 fps, that is 120 frames; at another frame rate, set the GOP length to approximately twice that rate. Keep the interval at or below four seconds.
  • Audio: Use an audio codec and bitrate supported by YouTube’s current encoder guidance, and check that the source actually contains the audio you expect to broadcast.
  • RTMPS: Prefer the RTMPS URL provided for the stream. Do not assume an old example endpoint is still correct.

Start a looping FFmpeg stream

This example transcodes a local video to H.264/AAC, loops it indefinitely, and sends it to an RTMPS endpoint. Replace the file path and endpoint with your own values. Keep the key protected as described below; do not paste a real key into a public script or shared terminal recording.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
ffmpeg -re -stream_loop -1 -i /path/to/video.mp4 
  -c:v libx264 -preset veryfast -b:v 17M -maxrate 17M -bufsize 34M 
  -pix_fmt yuv420p -r 60 -g 120 -keyint_min 120 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "RTMPS_INGEST_URL/STREAM_KEY"

-re reads the file at approximately real-time speed; -stream_loop -1 repeats it without an intentional end. The video options here are an example for H.264 at 1080p60, not a universal preset. If your source has a different frame rate, resolution, or audio layout, adjust the output rather than forcing these values blindly. Check FFmpeg’s output for encoder errors and verify that the bit rate can be sustained before relying on the stream.

The placeholder URL above represents the full RTMPS address and key supplied for your stream. Avoid placing a real key directly in shell history. One safer pattern is to read the endpoint and key from a permissions-restricted service environment file and have a wrapper construct the destination at runtime. Restrict access to that file and to the service definition; command arguments and logs can otherwise expose secrets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Keep the encoder running and recover deliberately

A terminal session alone is not a recovery plan. Run FFmpeg under a process supervisor such as systemd or another service manager, configure restart behavior for unexpected exits, and retain logs that let you diagnose failures. Add an alert for process exit or sustained network failure if the stream matters to your channel.

  • Make sure the VPS remains provisioned and the video stays available at the configured path.
  • Monitor disk space, CPU, outbound connectivity, and FFmpeg logs. Transcoding can use substantially more compute than stream-copying compatible media.
  • Test the supervisor’s restart behavior with a controlled stop before leaving the stream unattended.
  • Check Live Control Room after a restart. Whether a disconnected encoder resumes the same broadcast or requires an operator action depends on stream configuration and encoder behavior.
  • Decide how and when to end the broadcast. A looping file can continue until the process or broadcast is stopped.

YouTube’s API documentation describes binding a stream resource to broadcasts, including a 24/7 arrangement in which an ongoing broadcast continues while a separate interview broadcast is created and later completed. That API pattern is distinct from the incoming encoder connection; it does not guarantee that a VPS, network, or unattended FFmpeg process will never fail, and a channel does not need to use the API simply to send an encoder stream.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2Ă— USB C male to USB A female adapters and 2Ă— USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the stream and troubleshoot problems

Symptom Likely cause What to check or do
No preview in Live Control Room Wrong server URL or key, encoder error, or outbound connection issue Compare the configured destination with the current stream details in YouTube Studio, inspect FFmpeg logs, and confirm the VPS can reach the RTMPS endpoint on port 443.
Preview appears, but the public broadcast has not started The incoming encoder feed is present but the applicable Live Control Room go-live action has not been completed Check the stream state and use the relevant control in Live Control Room.
Dropped frames or unstable stream health Output bitrate exceeds sustainable VPS upload capacity, or the connection is unstable Check sustained outbound bandwidth and server network conditions. Lower output bitrate, resolution, or frame rate if needed, then confirm the settings still suit the source.
FFmpeg exits or the loop stops Encoder error, missing media file, exhausted disk space, or process termination Read the service and FFmpeg logs, confirm file access and free storage, and verify that the supervisor restarts the process as configured.
Stream works initially but does not recover after a disconnect Restart policy or YouTube broadcast behavior does not match the recovery expectation Test the configured restart path, inspect the stream state in Live Control Room, and decide whether an operator must restart or re-create the broadcast.
YouTube blocks or removes the stream Account eligibility or content-policy issue Review the channel’s live-stream status and YouTube’s policy notice. Do not try to evade a restriction by switching channels.

Copyright and YouTube policy still apply

YouTube Help says all live-stream content must follow its Community Guidelines and Terms of Service. Confirm that you have the necessary rights for both the video and every audio track before broadcasting; a VPS or an encoder does not change those obligations. YouTube’s general policy guidance cannot determine whether you personally hold rights to a particular recording, performance, documentary, or soundtrack.

If you plan multiple simultaneous outputs, YouTube’s current Help page states limits of up to 10 active streams per channel and up to three active streams per stream key. For one continuous stream, those limits usually do not affect setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Estimate the real cost of a VPS setup

The VPS bill is only one part of the operating cost. Compare plans using the storage needed for your source files, sustained outbound capacity, transfer allowance, CPU if transcoding, and monitoring or operator time. The higher the bitrate and the longer the broadcast runs, the more important outbound transfer terms become. No single server size, provider, price, or uptime figure is established as best for every stream; check current terms for the region and plan you are considering.

Self-managing FFmpeg gives you control over files and encoder settings, but you also own the deployment, logs, credential protection, monitoring, and recovery process. A hosted service can reduce that server-maintenance work, but verify its current features, pricing, and availability before choosing it.

Or let it run in the cloud

StreamNeo is a hosted option for keeping a pre-recorded YouTube stream running: upload your video, add your YouTube stream key, and go live. Nothing has to stay on at home; it streams the uploaded file at its original quality up to 4K 60fps for one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. The monthly option is $9.99 per month. Start your free day with StreamNeo.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Screening Room

  1. How to Send a YouTube Live Stream to a Premiere—and What “Premiere Playlist” Can’t DoAdmit one · BlogHow to Send a YouTube Live Stream to a Premiere-and What “Premiere Playlist” Can't DoOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Live Playlist from a Raspberry PiAdmit one · BlogHow to Run a YouTube Live Playlist from a Raspberry PiOpened04 OCT 2026Runtime4 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.