Recommended Free Tools
You can stream a video file from an Ubuntu server on Hetzner Cloud to YouTube Live by creating an encoder stream in YouTube Studio, using FFmpeg to send the file over YouTube’s RTMPS ingest URL, and supervising FFmpeg with systemd. The server can keep running after you disconnect from SSH, but a restart policy is not a guarantee of uninterrupted YouTube ingest: test the stream, monitor its health, and check recovery before relying on it.
This guide covers a cloud-hosted file source, not a camera feed. Hosting on Hetzner does not by itself establish the best route to YouTube or the best viewer experience in India; measure the stream’s outbound path and check playback from the locations that matter to your audience.
What you need before you start
- A Hetzner Cloud Ubuntu server with enough CPU capacity for your chosen encoding settings and reliable outbound bandwidth.
- A video file accessible to the server, for example under
/srv/stream/. - A YouTube channel with access to YouTube Studio’s Live Control Room.
- An FFmpeg build that supports the required RTMPS protocol and, if you use the example below, the
libx264encoder. - A way to keep the stream key secret and a plan to monitor the stream after it starts.
The commands and service file below are examples, not a tested configuration. Check the package names, service behavior, FFmpeg build, and URL format on your selected Ubuntu release and server.
Create a YouTube Live encoder stream
- Open YouTube Studio. Choose
Create > Go Liveand create or schedule an encoder stream in Live Control Room. - Copy the ingest URL and stream key. Find them under Stream settings. For encrypted ingest, reveal and copy the RTMPS URL using YouTube’s lock control. YouTube recommends RTMPS; do not substitute a guessed server URL or assume every channel displays the same URL shape.
- Protect the key. Treat it like a password. Do not paste a real key into a shared terminal, shell history, screenshots, public logs, or source control. If you think it has been exposed, reset it using YouTube’s stream-key controls.
- Keep Live Control Room open for the first test. You will use its preview and stream-health indicators to confirm that YouTube is receiving the signal.
Choose a resolution, bitrate, and keyframe interval
YouTube lists RTMP and RTMPS as supported ingest protocols and H.264, H.265/HEVC, and AV1 as video ingestion codecs. For a conventional CPU-based FFmpeg setup, H.264 is a straightforward choice if the installed build includes libx264.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall#1 Best Overall
- 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.
| Output target | YouTube-recommended H.264 bitrate | YouTube-listed minimum H.264 bitrate |
|---|---|---|
| 1080p at 30 fps | 10 Mbps | 5 Mbps |
| 720p at 30 fps | 6 Mbps | 3 Mbps |
These figures are from YouTube Help’s encoder-settings guidance accessed October 3, 2026; the page does not state a publication year. YouTube recommends constant bitrate (CBR), a two-second keyframe interval, and a maximum interval of four seconds. Choose a lower resolution or bitrate if the server’s CPU or measured outbound capacity cannot sustain the target.
Bandwidth in the relevant direction is outbound from the server. A download-speed test does not establish that upload capacity is sufficient or stable. YouTube’s streaming tips recommend leaving 20% headroom and testing the stream. Allow for audio, transport overhead, and fluctuations as well as the video bitrate.
Install FFmpeg and check the build
On Ubuntu, the package manager is one possible installation route. Check the package available for your Ubuntu release and whether it includes the encoders and protocols you need rather than assuming every build is identical.
sudo apt update
sudo apt install ffmpeg
ffmpeg -version
ffmpeg -protocols
ffmpeg -encoders
Look for RTMPS-related protocol support in the protocol list and libx264 in the encoder list if you intend to use the example command. If your installed build lacks a needed feature, select a suitable build for that Ubuntu release before proceeding. Do not put the stream key into diagnostic output you intend to share.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Rank #2
- 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.
Send and loop a video file with FFmpeg
FFmpeg’s documented real-time file pattern uses -re to read at the file’s natural rate and the FLV muxer for RTMP-style output. The example below adapts that pattern to an RTMPS destination and loops a file. It is an illustrative 30 fps configuration, not a universal command: confirm the source frame rate, dimensions, audio layout, encoder availability, actual keyframe interval, and the RTMPS URL syntax shown in your Live Control Room.
ffmpeg -re -stream_loop -1 -i /srv/stream/source.mp4
-c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k
-g 60 -keyint_min 60 -sc_threshold 0 -pix_fmt yuv420p
-c:a aac -b:a 128k -ar 44100
-f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"
Set YOUTUBE_RTMPS_URL to the exact RTMPS URL copied from Live Control Room and YOUTUBE_STREAM_KEY to the key. This command’s 4.5 Mbps video target is an example, not a YouTube recommendation for every resolution. At 30 fps, a GOP of 60 frames corresponds to two seconds; if the source or output frame rate differs, adjust the GOP so the interval remains appropriate. The command encodes rather than simply passing through the source, so check CPU use and output health.
-stream_loop -1 repeats the input indefinitely, but it cannot make the end and beginning of a file match. A cut, black frame, or audio discontinuity may occur at the loop point. Check that the file decodes and has the audio and video you expect before leaving it running.
Keep credentials out of command lines that may be saved in shell history or exposed in process listings. One practical approach is a root-readable environment file and a system service that loads it; access controls and logging still matter. The example service below uses that approach, but the precise security policy is your responsibility.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- 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 FFmpeg running after SSH disconnects with systemd
Running FFmpeg in an SSH session ties the process to that session unless you deliberately detach it. A systemd service instead lets the operating system start FFmpeg at boot and restart it after a process exit. It does not ensure YouTube is reachable, repair an invalid file or key, or prevent repeated failures.
1. Store the settings in a protected environment file
Create a file such as /etc/ffmpeg-youtube.env with the exact ingest URL and key. Keep the value syntax compatible with systemd’s environment-file format; avoid adding shell-specific syntax unless you have confirmed it is supported.
sudo install -m 600 -o root -g root /dev/null /etc/ffmpeg-youtube.env
sudoedit /etc/ffmpeg-youtube.env
YOUTUBE_RTMPS_URL=PASTE_THE_EXACT_RTMPS_URL_HERE
YOUTUBE_STREAM_KEY=PASTE_THE_PRIVATE_KEY_HERE
Do not publish this file or include its contents in support logs. If the key has been exposed, reset it in YouTube before restarting the service.
2. Create a service unit
Save a unit such as /etc/systemd/system/youtube-ffmpeg.service. Replace the file path and encoding options for your source. Confirm that the chosen ExecStart syntax and FFmpeg binary path work on your system.
Rank #4
- 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
[Unit]
Description=FFmpeg YouTube Live file stream
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/ffmpeg-youtube.env
ExecStart=/usr/bin/ffmpeg -re -stream_loop -1 -i /srv/stream/source.mp4 -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k -g 60 -keyint_min 60 -sc_threshold 0 -pix_fmt yuv420p -c:a aac -b:a 128k -ar 44100 -f flv ${YOUTUBE_RTMPS_URL}/${YOUTUBE_STREAM_KEY}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Systemd expands environment variables in the command; check the resulting command behavior carefully and do not expose it in logs or screenshots. If your RTMPS URL already contains a path separator or the key must be appended in a different form, follow the exact URL shape supplied by YouTube and validate it with a controlled test. Keep the unit and credential file readable only by administrators who need them.
3. Start it and inspect status and logs
sudo systemctl daemon-reload
sudo systemctl enable --now youtube-ffmpeg.service
sudo systemctl status youtube-ffmpeg.service
sudo journalctl -u youtube-ffmpeg.service -f
Use the journal to diagnose errors, but check that no diagnostic output or copied command reveals the stream key. To stop the stream cleanly, run sudo systemctl stop youtube-ffmpeg.service. To prevent it starting at the next boot as well, disable the unit with sudo systemctl disable youtube-ffmpeg.service.
Test the stream before leaving it unattended
- Confirm the preview. In YouTube Live Control Room, wait for the incoming preview and check that picture and audio are correct.
- Check stream health. Review the health indicators and warnings in Live Control Room rather than relying only on a running FFmpeg process.
- Measure outbound capacity. Test from the server and judge sustained upload performance against the full stream bitrate with headroom. Repeat under the conditions in which the server will actually run.
- Run an extended test. Observe CPU load, memory, network stability, file playback, and YouTube health over a meaningful period before calling the setup unattended.
- Test recovery deliberately. Stop the FFmpeg process and confirm systemd restarts it; then test a server reboot and confirm the service returns. Verify the resulting YouTube preview and health state after each test.
- Re-test after changes. Repeat the checks after changing resolution, frame rate, encoder settings, server type, file, or network route.
YouTube notes that streams under 12 hours are automatically archived. Do not assume that a continuously running stream will be archived as one uninterrupted, indefinitely available video; check YouTube’s current live-stream behavior and your channel’s archive after a test.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Hetzner Cloud, Ubuntu, and viewers in India
Hetzner documents native cloud-init auto-configuration for Cloud Networks on Ubuntu 22.04 or later, without extra software for that feature. Cloud Networks are for private network configuration; a simple public push to YouTube may not need one. This documentation does not establish that a particular server type has enough CPU for your encoding settings or that it has a good route to YouTube.
Best Value
- 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.
No specific Hetzner location is established here as best for Indian viewers, and no region-specific latency, YouTube ingest route quality, server price, or uptime guarantee is established. The server-to-YouTube ingest path and YouTube-to-viewer playback path are different. Test ingest from the actual server and, where practical, check playback from intended audience locations. Do not assume that Indian viewers require the server to be in India or that a particular region is fastest without measurements.
Troubleshooting common failures
| Symptom | Likely checks and fixes |
|---|---|
| YouTube shows no incoming preview | Confirm the service is active, inspect its logs, verify the copied RTMPS URL and stream key, and check that the FFmpeg build supports the protocol. Ensure the key has not been reset or mistyped. |
| SSL or RTMPS connection error | Check that you copied the encrypted RTMPS URL from Live Control Room and that the installed build supports the required protocol. YouTube identifies port 443 as a troubleshooting option for SSL connection errors; confirm the server’s network policy allows the relevant outbound traffic. |
| Stream health reports bitrate or connection problems | Measure sustained outbound bandwidth, leave headroom, and lower output resolution or bitrate if necessary. Check for network fluctuations rather than treating a fast download result as proof of upload capacity. |
| FFmpeg exits immediately or systemd keeps restarting it | Inspect journalctl -u youtube-ffmpeg.service for missing files, unsupported encoders or protocols, malformed URL syntax, permission errors, or invalid options. Correct the cause before treating automatic restart as recovery. |
| Video is choppy or the server is overloaded | Check CPU usage and whether the chosen encoder can sustain the selected frame size and rate. Reduce the output target or choose a suitable encoding approach for the server; then re-check the preview and stream health. |
| Picture is present but audio is missing or wrong | Check the source’s audio tracks and the FFmpeg audio options. Test the file locally or with a controlled stream before relying on it continuously. |
| The picture or audio jumps at the loop point | -stream_loop -1 repeats the file but does not create a seamless transition. Choose media whose ending and beginning work together, or use a separate playlist/transition workflow designed for that purpose. |
| The stream stops after a reboot | Check that the unit is enabled, the file and environment file are present and readable, and network-online ordering behaves as expected on the selected Ubuntu release. Inspect service status and logs after reboot. |
Or let it run in the cloud
If you do not want to maintain FFmpeg and a cloud server, StreamNeo keeps an uploaded video or playlist live on YouTube from the cloud:
- Upload your recording or build a playlist.
- Add your YouTube stream key once.
- Go live; StreamNeo loops the upload from the cloud, so no home computer or connection has to stay on.
Every slot supports the uploaded quality up to 4K 60fps at one flat price per slot, with no re-encoding or quality tiers; includes automatic recovery if YouTube drops the stream; and has a first day free with no card. The monthly option is $9.99 per month. StreamNeo streams to YouTube only and plays uploaded video rather than going live from a camera. UPI and cards are supported in India. Start the free first day with StreamNeo.
Quick Recap
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.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →




