October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober 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 Set Up a 24/7 YouTube Stream with a Rotating Playlist in FFmpeg

Use FFmpeg’s concat demuxer and infinite input looping to send a rotating playlist to YouTube Live—and understand the compatibility, bitrate, testing, and uptime work a 24/7 stream still needs.

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

You can loop a playlist into a YouTube Live broadcast with FFmpeg by putting compatible media files in a concat-demuxer list, looping that input with -stream_loop -1, and sending the encoded output to the server URL and stream key from YouTube Studio. That repeats the playlist; it does not keep a failed process, computer, network, or YouTube ingest session alive. Test the full setup and plan for monitoring and recovery before relying on it unattended.

What you need before you start

  • A current FFmpeg build with the video and audio encoders you intend to use. Check available encoders with ffmpeg -encoders.
  • A YouTube channel with live streaming enabled and an encoder stream created in YouTube Studio.
  • A playlist of media files stored where the machine running FFmpeg can read them.
  • A computer, power supply, and internet connection able to run continuously and sustain the stream’s upload bitrate.

For a large library, local storage capacity depends on the size and format of your files. An external SSD or hard drive can be useful, but it is optional; it does not improve stream reliability by itself.

Create a YouTube encoder stream and protect its key

  1. In YouTube Studio, choose Create → Go Live, then create or schedule a stream for encoder software. YouTube’s walkthrough is in Create a YouTube live stream with an encoder.
  2. Copy the server URL and stream key shown in the Live Control Room. YouTube describes stream keys as “like your YouTube stream’s password and address.” Treat the key as a credential: do not publish it in scripts, screenshots, or source control.
  3. If the key is exposed, reset it in Live Control Room and update FFmpeg with the replacement.
  4. Choose privacy and stream behavior in the live settings. YouTube documents stream keys, privacy, DVR, and auto-start/stop options in Manage live stream settings. Review those controls for your channel rather than assuming the broadcast will start or stop in a particular way.

Prefer RTMPS when available. YouTube recommends RTMPS as a secure extension of RTMP in its encoder settings and bitrate guidance.

Build the rotating playlist

Make a concat-demuxer file

Create a text file named playlist.txt in your working directory. Put the following header on the first line and one file entry per line:

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.
ffconcat version 1.0
file 'video-01.mp4'
file 'video-02.mp4'
file 'video-03.mp4'

Use paths relative to the playlist where practical. FFmpeg’s concat demuxer defaults to safe-path checks and rejects some unsafe path forms or directives. See the FFmpeg Formats Documentation for the concat demuxer’s options. The example command below uses -safe 0 to permit paths outside the default safe subset; omit it when safe relative paths are sufficient. Only disable the check for a playlist you trust.

Check compatibility before leaving it unattended

The concat demuxer joins media streams; it is not a general-purpose editor that normalizes each item. Files with different stream layouts, codecs, time bases, resolutions, or parameters can fail or behave badly at transitions. The most reliable route is to normalize the library to a consistent format before streaming. If the source files vary, use a filter/re-encode workflow and validate transitions. FFmpeg explains the distinction between the concat demuxer and concat filter in its FAQ.

Audio-only tracks and still images need additional input mapping or generated video/audio settings; the command below expects each playlist entry to provide compatible video and audio streams. Do not assume it will create a missing stream.

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.

Run FFmpeg to loop and send the stream

Replace the server URL and key placeholders with the values from your Live Control Room. Keep the key private; avoid saving a real key in a script that will be shared or checked into a repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt 
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k 
  -r 30 -g 60 -pix_fmt yuv420p 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://SERVER-URL/STREAM-KEY'
  • -re reads file input at normal playback speed rather than consuming it as fast as possible.
  • -stream_loop -1 repeats the specified input indefinitely. FFmpeg documents this option in its command documentation.
  • -f concat selects the concat demuxer; -i playlist.txt supplies the playlist.
  • -c:v libx264 and -c:a aac re-encode to common video and audio formats. This uses processing resources; confirm that your FFmpeg build includes the chosen encoder.
  • -b:v, -maxrate, and -bufsize set an example video rate-control configuration. The 4,500 kbps value is illustrative, not a universal recommendation; choose the output bitrate for the selected resolution, frame rate, content, and sustained upload capacity.
  • -r 30 sets 30 frames per second. -g 60 sets a 60-frame GOP, or a two-second keyframe interval at 30 fps.
  • -pix_fmt yuv420p sets a widely compatible pixel format. The audio options set AAC at 128 kbps and 44.1 kHz sampling.
  • -f flv selects the streaming output container used here; the quoted destination combines the server address and stream key supplied by YouTube.

Choose settings for the source, YouTube, and your connection

Resolution, codec, and bitrate

The command is a starting point, not a tested universal recipe. Match the output resolution and frame rate to your source and channel needs, then use the corresponding row and codec column in YouTube’s current settings table. For 1080p at 30 fps, YouTube’s current page (accessed 2026) lists an H.264 recommended bitrate of 10 Mbps; the AV1/H.265 ingest range in that row is 3–8 Mbps. These are codec-specific figures, not interchangeable limits. YouTube also advises choosing a quality that is reliable on the available connection. Compare the configured bitrate with sustained upload capacity and leave headroom rather than setting it equal to a speed-test peak.

Keyframes, rate control, and audio

YouTube recommends a two-second keyframe frequency and says not to exceed four seconds. At 30 fps, two seconds is 60 frames; at 60 fps, it is 120 frames. YouTube’s documented recommendation for stereo AAC audio is 128 kbps. Check the live encoder settings page for the current guidance on codec, bitrate, keyframes, and rate control before committing to a long broadcast: Choose live 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.

Stream copy versus re-encoding

To reduce processing load, you can try -c:v copy -c:a copy instead of encoding. That only works when every file has compatible streams and parameters and YouTube accepts the resulting output. Test the exact library and transitions first. If there are mismatches, normalize files in advance or use a filter/re-encode workflow; re-encoding costs compute but gives you more control over consistent output.

Test the broadcast before making it continuous

  1. Start FFmpeg and wait for the incoming preview in YouTube Live Control Room.
  2. Check that both picture and sound are present, transitions work, and the stream health indicators do not show a persistent problem.
  3. Start or confirm the broadcast according to the stream’s settings. For the first run, use a private or unlisted test where appropriate.
  4. Watch FFmpeg’s terminal output for input errors, encoder exits, dropped frames, or connection failures. YouTube recommends testing the encoder, checking the Live Control Room preview, and monitoring stream quality; see Streaming tips.

Use a speed test to check the uplink, but do not treat a brief peak result as guaranteed capacity for a continuous broadcast. A wired Ethernet connection may be a useful option for a stable local network, but it is not a stated YouTube requirement.

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

What “24/7” requires beyond a looping command

-stream_loop -1 loops FFmpeg’s input. It does not restart a crashed process, restore a failed internet connection, keep a computer powered, or guarantee that YouTube continues receiving the feed. The machine, power, network, media files, FFmpeg process, and YouTube ingest all have to remain available.

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
  • Keep logs and monitor the process for failures rather than assuming the playlist will run unattended forever.
  • A service manager or watchdog can restart a failed process, but configure and test it separately. A restart can interrupt the broadcast or require a new ingest session.
  • If uninterrupted delivery is important, plan and test power, network, and encoder recovery. A fallback encoder or network adds complexity and is a separate reliability design, not a feature of the loop option.
  • YouTube says streams under 12 hours are automatically archived. That statement does not establish that a single uninterrupted 24-hour stream will be archived in full. Check YouTube’s current long-stream archive behavior and record locally if retaining the whole program matters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

FFmpeg rejects a playlist path

Use safe relative paths if possible. The concat demuxer’s safe-path default rejects some path forms; if your trusted playlist requires other paths, review FFmpeg’s safe option documentation and use -safe 0 only deliberately.

The stream stops at a file boundary or shows errors

Inspect the media entries for incompatible codecs, stream layouts, time bases, or parameters. Normalize the files or use a filter/re-encode workflow, then test the transitions. The concat demuxer cannot make dissimilar files uniform by itself.

YouTube shows no preview or reports poor stream health

Confirm the destination uses the current server URL and stream key, verify the key has not been reset, and inspect FFmpeg’s connection and encoder logs. Reduce bitrate or output quality if the sustained uplink cannot carry the selected settings; compare with YouTube’s current codec-specific recommendations rather than relying on a speed-test peak.

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.

The video runs too fast or the output is too demanding

For file input, -re paces reading at playback speed. If CPU usage is excessive, verify that the system can encode the chosen resolution and frame rate, or test stream copy with fully compatible sources. Stream copy is not a fix for incompatible media.

The process exits and the stream does not resume

Looping does not supervise FFmpeg. Check the error log and input availability, then configure and test a process supervisor separately. A supervisor can relaunch the encoder, but it cannot promise an uninterrupted YouTube broadcast or eliminate network and power failures.

Or let it run in the cloud

If you want the uploaded playlist to keep a YouTube channel live without leaving a computer running at home, StreamNeo is a cloud service for looping uploaded videos on YouTube. Upload a recording or build a playlist, add your YouTube stream key once, and go live. The cloud keeps the stream running, so nothing has to stay on at home. Each slot streams your upload as made, up to 4K 60fps, at one flat price per slot; there are no quality tiers or re-encoding. StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. The monthly plan is $9.99 per month. StreamNeo streams to YouTube only and plays uploaded videos, not a live camera feed. Start your free day with StreamNeo.

Copyright and channel-policy checks

Only stream media you have the rights to broadcast. A playlist’s technical compatibility does not establish permission to use its contents, and looping a video does not bypass copyright enforcement or YouTube’s channel policies. Review rights for the video, music, images, and any other material in every file before going live. YouTube’s live-stream setup and encoder guidance does not guarantee that a particular playlist complies with copyright or monetization rules.

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 *

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.