Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober 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
VGSources
FFmpeg

How to Run a Continuous YouTube Stream on Ubuntu Without a Desktop

A practical headless Ubuntu guide to sending prerecorded video to YouTube Live with FFmpeg, supervising it with systemd, and checking YouTube stream health.

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

You can run a continuous YouTube stream from a headless Ubuntu server with FFmpeg: send a prepared video or playlist to YouTube Live over RTMPS, then use systemd to supervise FFmpeg. A desktop and OBS are not required for this file-based workflow. You still need an online host, a compatible FFmpeg build, a YouTube stream key, and enough sustained upload bandwidth.

How the headless streaming setup works

FFmpeg reads media on the Ubuntu host, encodes or passes through compatible audio and video, and sends the output to YouTube’s ingest endpoint using RTMPS. These are separate checks: systemd can restart a failed local FFmpeg process, while YouTube’s stream-health indicators tell you whether the platform is receiving a usable stream.

This guide assumes prerecorded media on disk. Camera capture, hardware encoders, and other live input sources need different input settings; adapt the input portion to the source you actually use.

Choose an Ubuntu host and prepare it

Existing machine or cloud VM

An existing Ubuntu machine avoids renting a separate host but must remain powered, connected, and reachable for maintenance. A rented Ubuntu VPS or cloud VM can run independently of your home computer, but compare recurring cost, sustained outbound bandwidth, host control, reliability, and access to logs before choosing. No provider-specific price or uptime claim is established here.

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.

Install and check FFmpeg

  1. Connect to the Ubuntu host and install FFmpeg using the package source appropriate for your Ubuntu release. Package builds can differ, so do not assume a particular input, encoder, or RTMPS capability without checking it.
  2. Run ffmpeg -version to confirm it is installed, and inspect available encoders and protocols with ffmpeg -encoders and ffmpeg -protocols. Confirm that your build has the encoder and RTMPS support required by your chosen command.
  3. Put the media in a stable location and ensure the account that will run the service can read it. Test the exact file and audio track before creating a continuously running service.

Create the YouTube Live stream and protect its key

  1. Open YouTube Live Control Room and create or schedule the live stream you intend to use.
  2. Copy that stream’s RTMPS URL and stream key. YouTube may show an ordinary RTMP URL by default; select and use the RTMPS URL for the encrypted ingest connection. YouTube recommends RTMPS for streaming. YouTube’s encoder settings guidance and its troubleshooting guidance explain the endpoint choice.
  3. Treat the stream key like a password. Do not publish it, commit it to a repository, or paste it into a publicly visible example. Restrict access to any configuration file containing it and avoid exposing it in shared logs.

Choose output settings YouTube can receive

YouTube’s encoder guidance, checked in 2026, lists H.264, H.265 (HEVC), and AV1 video, AAC or MP3 audio, a maximum frame rate of 60 fps, constant bitrate (CBR), and a 2-second keyframe interval; it says not to exceed 4 seconds. For stereo audio it lists 44.1 kHz and 128 kbps. The bitrate figures below are YouTube settings recommendations, not a performance test of Ubuntu, FFmpeg, or your connection.

H.264 target YouTube minimum YouTube recommended
720p at 30 fps 3 Mbps 8 Mbps
720p at 60 fps 3 Mbps 8 Mbps
1080p at 30 fps 5 Mbps 14 Mbps
1080p at 60 fps 6 Mbps 17 Mbps

Choose a bitrate your host’s upload connection can sustain with headroom, then test under representative conditions. A nominal connection speed or a recommended encoder bitrate is not a guarantee of stable delivery.

Build and test the FFmpeg command

For prerecorded files, FFmpeg documents using -re to read input at its native rate and the FLV muxer for an RTMP-family output. RTMPS is RTMP over a secure connection. The following is a pattern, not a universal playlist recipe; replace the input, endpoint, key handling, and encoding choices for your media and FFmpeg build.

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 -i /path/to/video.mp4 -c:v libx264 -preset veryfast -b:v 8M -maxrate 8M -bufsize 16M -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac -b:a 128k -ar 44100 -f flv "rtmps://YOUR_INGEST_URL/YOUR_STREAM_KEY"

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

This example illustrates a 720p30-class H.264 bitrate and a 2-second GOP at 30 fps; it does not scale or validate the input resolution for you. Confirm the input dimensions and frame rate, and adjust the output settings to match your chosen target and YouTube’s current guidance. Do not put a real key in a command you share: command-line arguments can be visible to other users or captured in logs. Use a protected configuration or other secret-handling method appropriate to your host.

Looping one file or a playlist

FFmpeg can be configured to repeat media, but there is no single playlist command certified for every collection. File durations, timestamps, transitions, variable frame rates, missing audio, and synchronization can all affect the result. Test transitions and audio/video sync using the actual files before leaving the process unattended. A simple loop flag may be suitable for one file; a playlist generally needs deliberate concat or playlist handling and compatible timestamps.

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.

Run FFmpeg under systemd

Use a dedicated unprivileged account and a systemd service so the encoder can start at boot and be restarted if the process exits. Keep the key out of world-readable files and source control. A service manager supervises the local process; it does not confirm YouTube is receiving healthy video.

Create a unit such as /etc/systemd/system/youtube-stream.service with the correct account, working directory, command, and protected secret configuration for your host. For example, the unit’s operational shape can include After=network-online.target, Wants=network-online.target, Restart=on-failure, and RestartSec=5 under the appropriate systemd sections. Validate the actual unit with systemd-analyze verify before enabling it; paths and secret handling must match your setup.

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. Reload unit definitions with sudo systemctl daemon-reload.
  2. Start the service with sudo systemctl start youtube-stream.service, then check sudo systemctl status youtube-stream.service.
  3. Enable startup after reboot with sudo systemctl enable youtube-stream.service.
  4. Inspect recent output with sudo journalctl -u youtube-stream.service -n 100 --no-pager.

Verify the stream at YouTube, not only on Ubuntu

Test with representative motion and audio, then check the Live Control Room’s incoming stream status, health indicators, and messages. YouTube’s LiveStreams API documentation defines statuses including active, ready, and inactive, plus health states and configuration issues. Those platform-side signals complement—not replace—your local service status and FFmpeg logs. YouTube LiveStreams API status and health documentation.

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

YouTube’s documented health issues include unsupported codecs, missing audio or video, excessive audio channels, bitrate problems, and keyframe intervals longer than four seconds. Its videoIngestionStarved condition indicates insufficient incoming video and may cause buffering. Check logs, host CPU load, and network delivery when it appears; the condition alone does not identify which component caused the shortage.

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

Troubleshoot common failures

Symptom What to check Next step
SSL error or connection timeout Confirm the URL is the stream’s RTMPS URL and the FFmpeg build supports RTMPS. If the URL is correct and the SSL error remains, YouTube advises trying port 443. See YouTube’s troubleshooting guidance.
YouTube reports unsupported media or missing audio/video Check the selected codecs, actual input streams, audio channel count, bitrate, and keyframe interval. Adjust the output to supported settings and test again; YouTube documents these as possible stream-configuration issues.
Stream appears sparse or viewers buffer Check for YouTube’s videoIngestionStarved condition, FFmpeg errors, host CPU load, and sustained upload capacity. Reduce output demands or address the bottleneck indicated by the checks, then verify stream health again.
systemd says active, but the broadcast is unhealthy A running process does not prove the ingest is healthy. Check YouTube’s incoming status and health messages as well as local logs.

Copyright, reused content, and continuous broadcasts

Only stream media you have the rights and permissions to broadcast. YouTube’s copyright and monetization policies apply to live streams and uploaded material; a technically valid FFmpeg command does not make music, gameplay footage, or other content authorized. Review YouTube’s current live encoder guidance and applicable policy pages for your channel and content before going live. Reused-content decisions are separate from whether the stream connects successfully.

The sources cited here do not establish a maximum continuous-broadcast duration or what archive/VOD retention will apply to a very long stream. Check YouTube’s current live-stream and archive settings for the specific broadcast rather than assuming an endless stream will be retained as one video.

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.

Or let it run in the cloud

If you want continuous prerecorded YouTube streaming without maintaining an Ubuntu host and FFmpeg service, StreamNeo is a cloud service from Yorker Media: upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded video, not a camera feed, and streams to YouTube only. Your computer and home connection do not have to stay on. Any quality up to 4K 60fps streams as uploaded at one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card, once per account. Monthly pricing is $9.99 per month. Start the free day on StreamNeo.

Frequently Asked Questions

Can Ubuntu run a YouTube livestream without a graphical desktop?

Yes. For prerecorded media, FFmpeg can send the stream to YouTube Live; a desktop environment is not required.

Does systemd guarantee viewers will see a healthy stream?

No. It can supervise the local FFmpeg process, but YouTube’s ingest status and stream-health indicators must also be checked.

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.

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 *

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
Crashes, No Sound, or Screen Glitches?Free driver 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.