October 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
24/7 streaming

How to Stream a Prerecorded 24/7 YouTube Channel with FFmpeg and systemd

A practical Linux workflow for looping prerecorded video to YouTube with FFmpeg and systemd, including ingest setup, service checks, troubleshooting and archive limits.

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

You can run a prerecorded YouTube channel continuously by looping a local video with FFmpeg and having systemd supervise the foreground FFmpeg process. Create a live stream in YouTube Studio, use the ingest URL and key shown for that stream, and verify the incoming preview and live state in Live Control Room. A running Linux service proves only that FFmpeg is running—not that YouTube is receiving a healthy broadcast.

What you need before starting

  • A Linux host that can remain powered on and connected to the internet. It may be a server or a home computer; you remain responsible for its power, network, storage and maintenance.
  • A compatible prerecorded video file stored at a stable path, such as /srv/video/channel.mp4.
  • FFmpeg and systemd installed. Check the actual binary and version on the machine you will use; options, codecs and service directives can vary by build and systemd version. Consult the FFmpeg documentation that matches your installation.
  • A YouTube channel enabled for live streaming and access to YouTube Studio’s Live Control Room.

Decide how you will handle long-running sessions and keep a source recording if you need a complete copy independent of YouTube’s archive. YouTube says streams under 12 hours are automatically archived; it does not guarantee a complete archive for a continuous event exceeding that threshold. YouTube’s encoder guide describes the live-stream setup and archive behavior.

Create a YouTube stream and get its ingest details

  1. In YouTube Studio, open Live Control Room and create or select a stream. If you schedule a broadcast, use that scheduled stream’s settings and watch page.
  2. Open the stream settings and copy the ingest URL and stream key supplied there. Use the protocol and server URL YouTube provides for this stream; do not assume every stream uses the same endpoint.
  3. Keep the key secret. Do not paste a real key into a public unit file, public repository, screenshot or support post. If it is exposed, replace or reset it using YouTube Studio’s available controls.
  4. Configure FFmpeg to send to the selected ingest endpoint. Start the encoder first. For a scheduled stream, YouTube instructs you to wait for the incoming preview and then click Go live in Live Control Room.
  5. After going live, check the event’s live state and the public, private or unlisted watch page as appropriate. Studio’s preview and live status—not the local process status—show whether YouTube has accepted the incoming stream.

See YouTube’s current encoder instructions for the Studio flow and settings presented for your account.

Loop a local video with FFmpeg

Check the media and FFmpeg build

Before building an unattended service, inspect the input file and confirm that your FFmpeg build can read it and that its audio and video tracks are suitable for YouTube’s selected ingest settings. The required encoding depends on the actual file, installed codecs and protocol. A command that works for one MP4 may not work for a different container or stream.

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.

RTMP example for a compatible file

This is a command shape to adapt and test, not a universal or tested recipe:

ffmpeg -re -stream_loop -1 -i /srv/video/channel.mp4 
  -c:v copy -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmp://a.rtmp.youtube.com/live2/REPLACE_WITH_STREAM_KEY'

-stream_loop -1 tells FFmpeg to repeat the input indefinitely. It belongs before that input’s -i. -re reads a file at its natural playback rate rather than sending it as fast as the machine can process it. The example copies the video stream and encodes audio as AAC, but stream copy is suitable only if the source tracks and output container are compatible. The illustrative URL and placeholder are not a substitute for the ingest URL and key shown in YouTube Studio.

When to transcode or handle audio differently

If stream copy is incompatible, transcode and choose video codec, pixel format, bitrate, frame rate and keyframe interval according to YouTube’s current encoder guidance and the settings Studio displays for your stream. Those values are source- and stream-dependent; do not treat a single set of values as correct for every file or ingest configuration. If the file has no audio, decide on an audio plan and verify it against the platform’s requirements rather than assuming a silent source will be accepted as-is.

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 options and supported codecs depend on the installed build. Check its documentation and test the exact input and output locally or with a safe test stream before deploying the service. The FFmpeg documentation is the primary reference.

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

Looping a sequence of documentaries

For multiple videos, prepare and validate the playlist or combined media input before putting it on air. Combining files into a continuous input can be complicated when clips have different codecs, durations, frame rates or audio layouts. Test transitions and timestamp continuity before streaming publicly; there is no one playlist command guaranteed to handle every mix of source media.

Use the ingest protocol shown in Studio

Do not reuse the RTMP/FLV example unchanged if YouTube Studio gives you an HLS endpoint. YouTube documents different ingest requirements for HLS, including higher latency than RTMP because HLS sends segments. Its HLS guidance specifies a TS segment format, segment durations of 1–4 seconds, a rolling playlist with no more than five outstanding segments, HTTPS POST/PUT, and HLS-specific codec options including HEVC as well as H.264. YouTube’s HLS setup instructions describe these constraints. Follow the current URL and protocol supplied for your selected stream.

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

Keep FFmpeg in the foreground

Use a system service that launches FFmpeg directly in the foreground. This lets systemd track the encoder process, start it at boot and apply a restart policy if that process exits. The following is a structural example, not a drop-in unit: adapt paths, account, environment-file handling and directives to your distribution and systemd version.

[Unit]
Description=YouTube FFmpeg stream
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=stream
ExecStart=/usr/bin/ffmpeg -re -stream_loop -1 -i /srv/video/channel.mp4 -c:v copy -c:a aac -b:a 128k -ar 44100 -f flv ${YOUTUBE_INGEST_URL}
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

This sample illustrates foreground supervision only. In particular, do not put a real key in a world-readable unit file or publish it in a command or screenshot. Use a protected configuration mechanism appropriate to your host, restrict access to the secret, and ensure the service account has only the file and device access it needs. Verify that the way you supply the ingest URL and key is supported by your FFmpeg invocation; service managers do not automatically expand arbitrary shell syntax in ExecStart.

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

Enable and inspect the service

After saving a correctly adapted unit, reload systemd’s unit definitions, enable the service for boot, and start it. Replace youtube-ffmpeg.service below with the unit name you actually created:

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
sudo systemctl daemon-reload
sudo systemctl enable --now youtube-ffmpeg.service
sudo systemctl status youtube-ffmpeg.service
sudo journalctl -u youtube-ffmpeg.service

Use systemctl status for current process state and journalctl for FFmpeg and service diagnostics, including after a restart. The practical systemd guidance here is a starting point; exact directives and behavior can vary with the installed version. Restart settings should include a reasonable delay so a persistent failure does not create a rapid retry loop.

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

Verify both the process and the broadcast

Process supervision and broadcast health are separate checks:

  • On the host: confirm the service is active and inspect recent journal entries for file errors, unsupported codecs, authentication failures, missing executables or network errors.
  • In YouTube Studio: confirm that the stream preview appears, the event reaches the intended live state, and the watch page has the intended visibility. A process can remain active while sending an invalid or rejected stream.
  • For unattended operation: consider an external check or alert that tests viewer-facing playback. Local service state alone does not establish that viewers can watch.

Test with a deliberately safe stream before relying on the unit for an unattended channel. A restart policy can recover from an FFmpeg process exit; it cannot fix a bad key, missing media, unsupported codec, repeated authentication rejection, full disk, unavailable network or an event that is not live in YouTube’s system.

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.

Plan session boundaries and archives for a 24/7 channel

A loop can keep sending media, but a nominally continuous 24/7 event runs past YouTube’s stated under-12-hour automatic-archive threshold. Do not assume one uninterrupted event will produce one complete replay. Decide whether to schedule and restart separate sessions, how to minimize gaps at boundaries, and where to retain a full source recording if the archive needs to be complete. Verify the current event and archive behavior in Studio; the cited YouTube guidance does not promise a complete replay of a stream exceeding the threshold.

Troubleshoot common failures

Symptom Likely area to check Next action
systemd reports the service failed or repeatedly restarts Executable path, unit syntax, media path, permissions or FFmpeg exit diagnostics Run systemctl status and inspect journalctl -u youtube-ffmpeg.service. Confirm the configured binary and source file exist and are readable by the service account.
Service is active but no preview appears in Studio Ingest URL or key, selected protocol, network access or unsupported output Compare the configured endpoint with the current stream settings in Studio, check the journal, and verify the matching RTMP or HLS requirements. Confirm the key has not been changed or exposed.
FFmpeg exits at startup with a media or codec error Input format, missing decoder/encoder, incompatible stream copy or incorrect options Check the actual file and FFmpeg build. Try an appropriate transcode rather than assuming the source can be copied into the selected output format.
Stream runs, but the event is not publicly viewable Live Control Room state or event visibility Check the preview and event status in Studio, complete the scheduled-stream Go live step if required, and verify the watch page’s visibility setting.
Stream drops and systemd keeps retrying Network, host resources, authentication or YouTube-side event state Use journal timestamps to find the failure, verify network and key, and allow a sensible restart delay. Confirm the stream recovers in Studio; an active process after restart is not proof of a healthy broadcast.
Continuous event has no complete single archive Session exceeded the under-12-hour automatic-archive threshold Plan event boundaries or preserve a separate complete source recording; do not rely on a single archive for an event longer than the stated threshold.

Costs and operating trade-offs

Self-hosting avoids a managed looping service, but the host’s power, network, storage, administration and recovery are your responsibility. A small Linux computer may be an option for a light stream-copy workload, but compatibility and sustained operation depend on the actual source and encode workload; this guide does not establish a particular device configuration. A rented VPS is another way to keep a Linux host available, with hosting cost and administration to evaluate for your situation. No provider pricing or reliability comparison is established here.

If you want the stream to run without maintaining an always-on computer or Linux service, StreamNeo is a cloud option for prerecorded YouTube streams: upload a recording or build a playlist, add your YouTube stream key, and go live. It plays uploaded video, not a live camera feed, and streams to YouTube.

Or let it run in the cloud

  1. Upload your recording or build a playlist.
  2. Add your YouTube stream key once.
  3. Go live; StreamNeo loops the video from the cloud, so your computer and home connection do not have to stay on.

Each slot streams the uploaded quality up to 4K 60fps at one flat price per slot, with no re-encode or quality tiers, and includes automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly: $9.99 per month. Start your free first day with StreamNeo.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

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 *

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.

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.