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
DocumentaryTube
FFmpeg

How to Run a YouTube Live Loop with systemd and FFmpeg

Use FFmpeg to send a repeating video or playlist to YouTube Live, and systemd to supervise the foreground process. Includes setup, encoding, security, testing, and troubleshooting.

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

To loop a prerecorded video on YouTube Live from Linux, use YouTube Live Control Room for the ingest URL and stream key, FFmpeg to read and send the media, and a systemd service to keep FFmpeg running and restart it if it exits unexpectedly. Test the stream in YouTube’s preview before starting the event. This guide covers the setup, playlist and encoding choices, service operation, and common failure checks.

How the YouTube Live loop works

The setup has three parts: YouTube receives the stream, FFmpeg produces it, and systemd supervises the FFmpeg process. YouTube provides the ingest address and stream key for the event. FFmpeg reads a file or playlist and sends compatible audio and video to that address. systemd runs FFmpeg in the foreground as a managed service, so it can start at boot and restart after certain failures.

These pieces do different jobs. A systemd restart policy can recover an exited process; it does not prove that YouTube is receiving usable video and audio. You still need to check the Live Control Room preview and stream-health indicators.

What you need before configuring the service

  • A Linux host that stays available while the event runs, with FFmpeg and systemd installed. It can be a machine you already operate or an appropriately configured hosted server; neither a VPS nor specific hardware is required.
  • A prerecorded video, or a playlist whose files are readable by the service account.
  • A YouTube channel with live streaming enabled, plus a live event created or scheduled in YouTube Studio.
  • A stable upload connection with enough capacity for the chosen output bitrate.

YouTube says first-time live-streaming enablement can take up to 24 hours. Check the current setup guidance if live streaming is not yet enabled: Create a YouTube live stream with an encoder.

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 absolute paths for media and configuration, and a dedicated low-privilege Linux account for the service where practical. Treat the stream key like a password: avoid putting it in a world-readable unit file, a public script, or a command transcript. Secret-handling directives and environment-file behavior vary by systemd version and configuration, so check the manual installed on your host before choosing a storage method. Do not copy a credential directive from an example without verifying that your version supports it.

Get the YouTube ingest URL and stream key

  1. In YouTube Studio, create or schedule the live event using the encoder workflow.
  2. Open that event’s stream settings and copy the current stream URL and stream key.
  3. Configure FFmpeg to publish to the URL using the key as the stream name or key component, following the format required by your YouTube settings and FFmpeg build.
  4. Keep the key private. If it is exposed, reset it in YouTube Studio and update the service configuration before streaming again.

YouTube describes a stream key as similar to a password and address. Its setup pages can change, so follow the current event controls rather than relying on a fixed sequence of button labels. Use RTMPS when supported by your FFmpeg build and the YouTube configuration; YouTube recommends encrypted RTMPS transport. See Manage live stream settings and the FFmpeg Protocols Documentation.

Choose one file or a playlist

Repeat one file

A single-file loop is the simpler case. FFmpeg offers input-level looping options, but their meaning depends on the input demuxer and installed build. Check the manual for your FFmpeg version and test the actual file. Do not assume that an option used to repeat one input behaves like the concat demuxer’s playlist loop directive.

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.

Loop a playlist with the concat demuxer

The concat demuxer can read a defined list of files and repeat it with its loop option. It has input-format expectations, however. Files with incompatible codecs or stream layouts, or with troublesome timestamps, may not transition as intended. For a stable playlist, use compatible media or prepare a consistent output format, then test the complete sequence—including the transition from the last item back to the first.

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

Consult the FFmpeg Formats Documentation matching the installed release for exact concat syntax and loop behavior. The manual is live and may describe options differently across versions.

Set output that YouTube can ingest

YouTube’s encoder guidance, checked in 2026, specifies RTMP or RTMPS, H.264, H.265, or AV1 video, up to 60 fps, constant bitrate (CBR), and a recommended two-second keyframe interval; do not exceed four seconds. For audio, the guide lists AAC or MP3. Choose a bitrate that matches the resolution, frame rate, codec, and dependable upload capacity rather than maximizing quality beyond what the connection can sustain. See YouTube’s encoder settings, bitrates, and resolutions.

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.

For reference, YouTube Help’s current guidance checked in 2026 recommends 14 Mbps for 1080p at 30 fps using H.264, and 10 Mbps for 1080p at 30 fps using H.265 or AV1. At 720p and 30 fps, its table lists 8 Mbps for H.264 and 6 Mbps for H.265 or AV1. These are recommendations, not guarantees of quality or successful delivery; stable upload capacity and a test stream still matter.

Re-encode or stream-copy?

Re-encoding gives control over the outgoing codec, bitrate, frame rate, and keyframe interval, but uses CPU and can introduce encoding load. Stream-copy/remux avoids re-encoding and its associated CPU work, but only makes sense when the input streams and timestamps are suitable for the desired YouTube output. These are engineering trade-offs, not a guarantee that either method will work for a particular file. Check the media properties, FFmpeg build, and YouTube’s accepted settings, then test the output.

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

Run FFmpeg as a systemd service

Use a long-running foreground FFmpeg process managed by a systemd service, typically a simple service type where appropriate for the host’s systemd version. Do not background FFmpeg inside the unit: systemd should supervise the process it starts. Set a stable working directory if the command needs one, or use absolute paths. Let standard output and error flow to the journal so you can inspect FFmpeg’s messages.

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

A sensible starting policy for many long-running services is to restart on failure with a delay, rather than retrying rapidly. The systemd project’s NEWS recommends restart-on-failure or restart-on-abnormal for long-running services; consult your installed systemd service and execution manuals for the exact directives and behavior on your version. Also verify restart throttling, shutdown timing, any sandboxing settings, and credential handling locally. There is no universal unit file that is safe to paste unchanged across distributions and versions.

Keep the stream key out of illustrative commands and unit text that others can read. Configure its actual storage using a method documented for your installed systemd version, with file permissions limited to the service and authorized administrators.

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

Start, preview, and monitor the stream

  1. Reload systemd’s unit configuration after creating or changing the service, using the command documented for your distribution.
  2. Start the service and inspect its status. Check the journal for FFmpeg input errors, connection failures, encoder output, and repeated restarts.
  3. Open the live event in YouTube Studio and wait for the encoder preview. Confirm that both picture and sound are present and that motion and audio behave normally.
  4. Review YouTube’s stream-health messages and warnings. Start the event in Studio if the chosen event workflow requires the creator to click “Go live.”
  5. During operation, monitor the process and YouTube’s ingest health. A running FFmpeg process alone is not proof that viewers can see and hear the stream.

YouTube recommends testing and monitoring the stream, including representative audio and motion. Its guidance also says streams under 12 hours are automatically archived. Plan event boundaries and check current YouTube limits rather than assuming one live event can run indefinitely or that an archive will persist without limit.

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.

Troubleshoot common failures

Symptom What to check Next step
The service exits or repeatedly restarts Read the systemd status and journal for the FFmpeg exit reason, missing files, invalid options, or connection errors. Correct the underlying command, path, permissions, or network issue. A restart policy cannot repair a persistent configuration error.
FFmpeg is running but YouTube has no preview Check the ingest URL and key, the selected event, RTMP/RTMPS support in the installed FFmpeg build, and YouTube’s stream-health messages. Confirm the key belongs to the active event, reset it if exposed, and test a fresh connection using YouTube’s current encoder guidance.
Preview appears but video or audio is unusable Check input readability, codec and stream layout, bitrate, keyframe interval, timestamps, and FFmpeg encoder output. Try a compatible file or playlist and appropriate output settings, then preview again before starting the event.
Playlist stops or glitches at a transition Compare the files’ codecs, stream layouts, and timestamps; verify concat syntax against the installed FFmpeg manual. Prepare a consistent playlist or use an input workflow suited to the files, and test every transition including the loop back to the beginning.
Stream drops during the event Check upload stability, YouTube ingest health, and the journal. Distinguish a dead FFmpeg process from a live process sending unusable media. Use systemd recovery for process exits, but add application-level health monitoring if you need to detect a process that remains alive while the outgoing stream is unhealthy.

Choose where the Linux service runs

A local Linux host gives you control and may make use of equipment and connectivity you already have, but it must remain powered on and connected for the event. A hosted Linux server can avoid relying on your home machine, but adds recurring hosting cost and still requires you to manage FFmpeg, systemd, media access, network performance, and YouTube’s event limits. Neither deployment type is required by the software workflow.

Or let it run in the cloud

If you want a YouTube prerecorded-video loop without keeping a Linux host running, StreamNeo runs the stream from the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; the video streams as uploaded, up to 4K 60fps, at one price per slot, and StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. StreamNeo streams to YouTube only. Start at StreamNeo’s free trial.

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 the Screening Room

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.