Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
VGSources
FFmpeg

How to Stream a Folder of Videos to YouTube Live from a Headless Ubuntu VPS

Use FFmpeg to send an ordered folder playlist from a headless Ubuntu VPS to YouTube Live over RTMPS, with practical guidance for settings, service restarts, testing, and troubleshooting.

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

You can stream local video files from a headless Ubuntu VPS to YouTube Live with FFmpeg: prepare an ordered playlist, send it to the RTMPS ingest URL and stream key from YouTube Live Control Room, then check YouTube’s preview and stream health. A systemd service can restart a failed FFmpeg process, but it cannot guarantee an uninterrupted or healthy broadcast. The playlist and service setup below is an implementation approach, not a YouTube-prescribed recipe.

What you need before you start

  • An Ubuntu VPS with the video files stored locally, enough CPU for any transcoding you plan to do, and upload capacity that can sustain your chosen bitrate.
  • FFmpeg installed with the protocols and codecs your workflow requires. Ubuntu release, package version, and build options vary, so check your installed build rather than assuming every package supports every codec or RTMPS configuration.
  • A YouTube channel able to start a live stream, and access to the stream’s RTMPS URL and stream key in Live Control Room.
  • A set of video files that you have permission to broadcast and that you have checked for compatibility across playlist transitions.

There is no single YouTube-documented FFmpeg command for streaming an arbitrary folder. File formats, dimensions, frame rates, audio layouts, FFmpeg builds, and VPS capacity differ. Treat the playlist and command as a workflow to adapt and test with your own files.

Prepare an ordered playlist

Choose the playback order explicitly

Do not rely on a shell wildcard to define the order you want. Create a playlist text file with one entry per file, in the intended sequence. For FFmpeg’s concat demuxer, the general format is a line containing file 'path/to/video.mp4' for each entry. Use paths that resolve from the directory where the command will run, or use absolute paths. If a file name contains a single quote, escape it correctly for the concat-list format or rename the file to avoid ambiguity.

file '/srv/videos/01-opening.mp4'
file '/srv/videos/02-gameplay.mp4'
file '/srv/videos/03-finale.mp4'

This is an FFmpeg implementation pattern, not a YouTube requirement. Verify the syntax against the FFmpeg version installed on your VPS and test the actual list before scheduling a public broadcast.

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.

Check what happens at file boundaries

Files with different codecs, dimensions, frame rates, pixel formats, or audio layouts may not play continuously when concatenated using stream copy. Test transitions—not just the first file. If the files are incompatible, normalize them to a common output profile or use an FFmpeg workflow that decodes and re-encodes them. Re-encoding gives you control over output settings but uses VPS CPU; stream copy can reduce CPU use when the streams are compatible, but does not make arbitrary mixed files compatible.

Choose output settings YouTube can ingest

YouTube’s encoder guidance supports RTMP/RTMPS with H.264, H.265/HEVC, or AV1 video, AAC or MP3 audio, a maximum of 60 fps, CBR bitrate encoding, and a recommended two-second keyframe interval that should not exceed four seconds. For a conventional SDR setup, H.264 video with AAC audio is a straightforward supported combination. For SDR, YouTube recommends Rec. 709 color space and 8-bit depth. Match the output to your source and the upload capacity you have measured on the VPS.

Use bitrate guidance for the exact profile

YouTube’s published bitrate table gives different minimum and recommended rates by codec, resolution, and frame rate. Examples below are YouTube’s 1080p30 and 720p30 values, accessed in 2026; they are ingest guidance, not proof that your VPS or network route can sustain the rate.

Output profile YouTube minimum YouTube recommended
H.264, 1080p30 5 Mbps 14 Mbps
AV1 or H.265, 1080p30 4 Mbps 10 Mbps
H.264, 720p30 3 Mbps 8 Mbps

Choose the row matching the codec, resolution, and frame rate you intend to send; consult YouTube’s current table for other profiles. Leave capacity for stable delivery rather than choosing a rate solely because it is listed as recommended.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Set keyframes and audio deliberately

  • Use CBR and set a keyframe every two seconds; do not exceed YouTube’s four-second maximum guidance.
  • For stereo audio, YouTube lists 44.1 kHz and 128 Kbps. For 5.1 audio, it lists 48 kHz and 384 Kbps.
  • Confirm the source contains the audio stream you intend to send and that the output uses a supported audio codec.

Get the RTMPS URL and stream key

  1. Open YouTube Live Control Room and create or select the live stream you plan to use.
  2. Open the stream settings and reveal the RTMPS URL using the lock control, then copy the URL and stream key exactly as shown.
  3. Configure FFmpeg to send to that URL with the associated stream key. Some encoders accept the URL and key separately; others expect the stream name appended to the URL as STREAM_URL/STREAM_NAME. Follow the format your FFmpeg configuration uses.

YouTube recommends RTMPS, which carries RTMP over TLS/SSL. If the connection fails, first check that you copied the RTMPS URL and key accurately. YouTube advises verifying that the URL uses rtmps and, where needed, trying port 443 for connection or certificate problems. Confirm that your FFmpeg build supports the protocol and that the VPS firewall and network allow the connection.

Protect the key

Treat the stream key like a password: do not put it in a public script or repository, restrict access to any configuration file containing it, and rotate it if it is exposed. These are prudent VPS security practices; YouTube’s requirement is that the encoder use the key assigned to the stream.

Run FFmpeg on the VPS

The exact command depends on whether your files can be copied without re-encoding or need normalization, and on how your FFmpeg build accepts the destination and key. Do not assume one stream-copy command will handle every folder. Adapt the playlist input and output options to the selected profile, set CBR and a two-second keyframe interval, and supply the RTMPS endpoint and key without exposing the key publicly.

Before making the command unattended, run it interactively and inspect FFmpeg’s output for connection errors, missing streams, or encoder problems. Check that the VPS sustains the selected bitrate and that the expected video and audio reach YouTube. A successful local process alone does not establish that the broadcast is healthy.

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 process running with systemd

For unattended operation, you can run the FFmpeg command as a systemd service with restart behavior. A community Ubuntu example uses this general pattern, but it is not a YouTube-endorsed configuration. Keep the command and secrets accessible only to the service account and use file permissions that limit who can read them.

A systemd restart can relaunch a failed local process. It cannot by itself guarantee network continuity, manage every YouTube broadcast lifecycle state, or verify that a resumed stream is healthy. Check service logs and YouTube’s live status rather than treating automatic process restart as proof of continuity.

Preflight and monitor the live stream

  1. Run a representative test using the playlist, output profile, and VPS network you intend to use. YouTube advises testing before starting a live stream.
  2. Open the stream preview in Live Control Room and confirm motion, resolution, frame rate, and audible sound.
  3. Review YouTube’s stream health status and any configuration messages before relying on a long-running broadcast.
  4. During operation, check both FFmpeg or systemd logs on the VPS and YouTube’s health messages. Resolve warnings instead of assuming a stable process means a stable ingest.

YouTube’s stream health diagnostics can flag issues including low or high video bitrate, missing audio, unsupported audio codec, audio sample-rate problems, unsuitable keyframe spacing, frame-rate mismatch, or stream configuration problems.

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

Troubleshoot common failures

YouTube does not receive video

Compare the RTMPS URL and stream key character for character with Live Control Room. Confirm that the endpoint is reachable through the VPS firewall and that FFmpeg’s build supports the required protocol. For connection or certificate issues, verify the URL uses rtmps; YouTube says port 443 may be worth trying where needed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

The preview has no sound

Check that the source file actually has audio, that FFmpeg selects or maps the intended audio stream, and that the output codec is AAC or MP3. YouTube identifies missing audio, unsupported codecs, and audio sample-rate problems as possible health issues.

The stream buffers or YouTube reports a bitrate or timing issue

Compare the sent bitrate with YouTube’s guidance for the actual codec, resolution, and frame rate. Check that the VPS upload route sustains that rate, output frame rate matches the selected configuration, encoding uses CBR, and keyframes are two seconds apart and no more than four seconds apart.

Playback breaks or changes quality between files

Inspect codecs, dimensions, frame rates, pixel formats, and audio layouts at each playlist boundary. If they differ, test a normalized set or transcode to a common profile. Do not assume a playlist that starts successfully will remain continuous when it reaches a different file.

FFmpeg exits and systemd restarts it, but the broadcast is still unhealthy

Check the service logs for the original failure, then inspect YouTube’s current preview and health status. A process restart addresses a local process failure; it does not confirm that YouTube has resumed ingest or that the new output meets the stream configuration.

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 your goal is to keep uploaded videos looping on YouTube Live without maintaining a VPS command and service, StreamNeo is a cloud option. Upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded videos to YouTube; it does not broadcast from a camera.

  • Your computer and home connection do not have to stay on.
  • Every quality up to 4K 60fps is streamed as uploaded, at one flat price per slot, with no re-encode or quality tiers.
  • It automatically recovers if YouTube drops the stream.
  • The first day is free with no card. The monthly option is $9.99 per month.

See StreamNeo for details, or start your free first day.

Copyright and channel eligibility

Only stream videos you have rights to use on YouTube Live, including the necessary rights to music, gameplay footage, and other material in the files. A technically healthy stream does not establish that the content complies with copyright rules or YouTube’s channel and live-stream requirements. Check your channel’s eligibility and YouTube’s current policies before broadcasting; the requirements can depend on account status and may change.

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
PC Slower Than It Used to Be?Free scan - under a minute
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.