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 DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
24/7 streaming

How to Set Up a Continuous YouTube Stream on a Hetzner VPS

Run a pre-recorded video continuously to YouTube from a Hetzner VPS with FFmpeg, while accounting for stream settings, traffic limits, security, and recovery.

By VGSources Team 7 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can keep a pre-recorded video streaming continuously to YouTube from a Hetzner Cloud VPS by running FFmpeg in real-time mode, sending its output to the broadcast’s RTMPS ingest URL, and supervising the encoder so it can restart after failures. YouTube and Hetzner do not guarantee uninterrupted uptime, so plan to monitor the stream and test recovery before relying on it.

What you need before you start

  • A Hetzner Cloud server with an internet-reachable public network interface and enough CPU, memory, and outbound traffic allowance for your stream.
  • A compatible video file stored on the VPS or otherwise available to it. This method loops a file; it does not stream live camera input.
  • A YouTube channel eligible to create a live broadcast, plus the matching YouTube ingest URL and stream key.
  • FFmpeg installed on the server, SSH access, and a plan for process supervision, monitoring, and recovery.

Check YouTube’s current live encoder settings and live streaming setup guidance before configuring the encoder. The steps and command below are an implementation pattern, not a tested, universally working recipe for every FFmpeg build, input file, or account.

Choose the stream settings

Match resolution and bitrate

YouTube’s current H.264 guidance recommends 10 Mbps for 1080p at 30 fps and 4 Mbps for 240p–720p at 30 fps. These are YouTube recommendations, not a guarantee that a particular server or source will remain stable. Choose a resolution and frame rate your source can support, then check that the VPS can sustain the required outbound traffic.

For a straightforward SDR stream, 720p30 or 1080p30, constant bitrate (CBR), AAC audio, and a two-second keyframe interval are sensible starting points. Do not apply one bitrate to every resolution, frame rate, or codec. YouTube documents H.264, H.265, and AV1 video, AAC or MP3 audio, and up to 60 fps; available combinations and appropriate bitrates depend on the chosen format.

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.
#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.

Use RTMPS and a two-second keyframe interval

YouTube recommends RTMPS, the secure extension of RTMP, and recommends a keyframe every two seconds, with four seconds as the maximum recommended interval. RTMPS protects the encoder-to-ingest connection in transit; it does not make a publicly exposed stream key safe.

Create the YouTube broadcast and protect its stream key

  1. Open YouTube Live Control Room and create or select the intended broadcast. You can also create a broadcast through YouTube’s Live Streaming API; API configuration includes ingestion type and stream URL fields.
  2. Copy the ingest URL and stream key associated with that broadcast. Use the exact values YouTube displays—do not substitute a generic endpoint or a key from another broadcast.
  3. Keep the stream key secret. Treat it as a publishing credential: do not put it in source control, share it, or expose it in a public log. Store it in a restricted configuration file or another protected secret store. Regenerate it if it is exposed.
  4. After connecting FFmpeg, check the broadcast preview and YouTube’s stream-health diagnostics before making the broadcast public.

Prepare the Hetzner VPS

Check network access and firewall policy

The VPS needs outbound internet connectivity to reach YouTube’s ingest service. Hetzner’s Cloud server overview explains server networking and public Primary IP options. If you have restricted egress with a Cloud Firewall, confirm its rules allow the needed outgoing connection.

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.

Check traffic allowance and estimate egress

Outbound video to YouTube counts as traffic from Hetzner. Hetzner’s Cloud traffic documentation lists 20 TB of included monthly traffic for EU CX, CPX, and CAX Cloud Servers; allowances vary by product and region, including in the US and Singapore. The documentation says excess traffic is charged in 100 MB blocks. Check the current allowance and overage terms for your exact account, plan, and server location before choosing a bitrate.

Estimate data use by multiplying the stream’s total bitrate by the number of broadcast hours, then allow for protocol overhead, retries, audio, software updates, and other server traffic. As arithmetic, a continuous 1 Mbps stream for 30 days is about 324 GB in decimal units before overhead; actual usage depends on the bitrate and runtime.

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.

Understand the network and CPU limits

Hetzner says Cloud bandwidth is not guaranteed; its FAQ says customers can expect about 300–500 Mbit/s while Cloud instances share the host’s 10 Gbit connection. Treat that as expected host networking, not a per-instance speed guarantee. Hetzner distinguishes shared-resource from dedicated-resource plans; if you transcode under heavy CPU load, check the plan’s resource model and measure CPU and network behavior on the actual server.

Install FFmpeg and run a looping stream

Install FFmpeg using the package manager for your VPS operating system, then verify that the installed build includes the input and output support you need. Put the source file in a stable location, such as /srv/stream/video.mp4, and make sure the account that runs FFmpeg can read it.

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

This illustrative command loops one file, reads it in real time, encodes H.264 video at 4 Mbps and 30 fps, sets a 60-frame GOP (two seconds at 30 fps), encodes AAC audio at 128 kbps, and sends the output in FLV format. The 4 Mbps video setting aligns with YouTube’s recommendation for 240p–720p30; choose different values if your intended resolution or frame rate differs.

ffmpeg -re -stream_loop -1 -i /srv/stream/video.mp4 
  -c:v libx264 -preset veryfast -b:v 4M -maxrate 4M -bufsize 8M 
  -r 30 -g 60 -c:a aac -b:a 128k 
  -f flv 'rtmps://INGEST_HOST/APP/STREAM_KEY'

Replace the URL placeholders with the exact RTMPS ingest URL and stream key shown for your broadcast. Keep the real key out of shell history and visible logs; the example uses a literal URL only to show where the endpoint goes, not to recommend storing credentials in a script. The command is not verified for every FFmpeg build or input. Test the source file, output settings, and reconnect behavior on your actual server. A file with incompatible codecs, damaged timestamps, or an unexpected audio layout may need different input or encoding options.

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.

Run it as a supervised service

Do not rely on an interactive SSH session to keep FFmpeg alive. Run it as a dedicated unprivileged user under a process supervisor such as systemd, configured to restart the process on failure. Restrict access to the service configuration and any file containing the stream key. A supervisor can restart a process; it cannot repair a missing source file, exhausted traffic allowance, invalid key, or YouTube-side issue.

There is no universal systemd unit or seamless reconnect behavior established for this setup. Choose restart behavior for your particular command, then test what happens when the input disappears, the network drops, FFmpeg exits, and the server reboots.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify the stream and keep it healthy

  1. Start FFmpeg and check its service status and logs for input, encoding, and connection errors.
  2. In YouTube Live Control Room, confirm that the preview appears and review stream-health diagnostics. Resolve warnings before making the broadcast public.
  3. Observe CPU, memory, network throughput, source-file availability, and egress usage. A process that is running does not by itself prove that YouTube is receiving a healthy stream.
  4. Test recovery by stopping FFmpeg, interrupting its network access, and restarting the VPS during a controlled session. Confirm what the supervisor does and whether YouTube resumes receiving the stream.
  5. Recheck the broadcast and logs after any change to the media, FFmpeg build, server plan, firewall, or stream key.

Troubleshooting common failures

Symptom Likely cause What to check or do
YouTube shows no incoming stream Wrong ingest URL or stream key, blocked outbound connection, or FFmpeg output failure. Compare the endpoint and key with the selected broadcast, check FFmpeg logs and egress firewall rules, then reconnect and inspect the preview.
Stream health is poor or unstable Bitrate exceeds stable outbound capacity, encoding load is too high, or the source and output settings do not match well. Check CPU and network behavior on the VPS, reduce resolution or bitrate if needed, use CBR, and keep the keyframe interval within YouTube’s guidance.
FFmpeg exits when the SSH session ends The process was launched in the interactive session rather than a supervisor. Run it under systemd or another process supervisor, and check the service status and logs after disconnecting.
FFmpeg restarts but the stream does not recover The source is unavailable, the key or endpoint is invalid, or the connection failure requires different handling. Inspect the restart logs and YouTube stream health; test the recovery path on the actual media and server rather than assuming restart guarantees reconnection.
Traffic use or charges are higher than expected Continuous outbound bitrate, retries, other server traffic, or a plan/location allowance smaller than assumed. Compare measured traffic with the exact Hetzner plan’s current regional allowance and overage terms.

Rights and YouTube policy still apply

A VPS and an RTMPS connection do not give you rights to broadcast the video, music, artwork, or other material in the stream. Confirm that you have the necessary rights and review YouTube’s current rules for the content and monetization approach you plan to use. Whether a particular channel or continuous stream meets YouTube’s eligibility and policy requirements depends on its circumstances.

Or let it run in the cloud

If you would rather not operate a VPS, FFmpeg process, supervisor, and recovery checks, StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos. Upload a recording or build a playlist, add your YouTube stream key, and go live. It loops the uploaded video from the cloud; it does not stream from a camera or to other platforms.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Nothing needs to stay on at home; the stream runs from the cloud.
  • Any quality up to 4K 60fps at one flat price per slot, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free, with no card required.

Monthly: $9.99 per month. For this setup, StreamNeo is the managed alternative to a self-managed VPS; the VPS gives you control over the server and FFmpeg, while StreamNeo avoids keeping that streaming process running on your own infrastructure. Start the free day on 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.

Leave a Reply

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

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

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.