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
24/7 streaming

How to Set Up a 24/7 YouTube Stream with a Rotating Playlist in FFmpeg

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, and sending the output to YouTube’s ingest server with your stream key. The command can repeat the playlist indefinitely, but it cannot keep a computer, network, or failed FFmpeg process alive: test the stream and arrange recovery separately if you need it to run unattended.

What you need before you start

  • A current FFmpeg build with the video and audio encoders you plan to use. Check available encoders with ffmpeg -encoders.
  • Video files with compatible stream layouts and parameters. A concat-demuxer playlist is most reliable when the files share compatible streams, codecs, time bases, and parameters.
  • A sustained internet upload connection with headroom above your chosen stream bitrate. A speed-test peak is not a dependable target bitrate.
  • A YouTube channel that can create a live stream, plus its server URL and stream key from YouTube Studio.
  • Enough local storage for your media library. An external drive is optional; the required capacity depends on the size of your files.

Use a private or unlisted test broadcast before relying on the setup. YouTube’s encoder setup guidance covers connecting an encoder and managing a live stream.

Get the YouTube ingest URL and protect your stream key

  1. In YouTube Studio, open Create → Go Live and create or schedule an encoder stream.
  2. Copy the server URL and stream key shown for that stream.
  3. Keep the key private. YouTube describes stream keys as “like your YouTube stream’s password and address.” Do not publish it in a script, screenshot, or source-control repository. If it is exposed, reset it in Live Control Room and replace it in your FFmpeg setup. See YouTube’s live-stream settings documentation.

Prefer RTMPS when it is available. YouTube recommends it as the secure extension of RTMP; it encrypts the connection through to YouTube’s servers. Use the ingest URL YouTube provides rather than guessing a server address.

Prepare the rotating playlist

Create the concat list

In a working directory, create playlist.txt with one media file per line:

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.
#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; its safe option is enabled by default and rejects unsafe paths or directives. If you use absolute paths or other forms outside the safe subset, review the FFmpeg formats documentation. Disable safety checks only for a list you trust.

Check the files and transitions

The concat demuxer joins media streams; it does not make different source formats uniform. Mismatched resolutions, codecs, stream layouts, or parameters can cause failures or bad transitions. Normalize the files to a consistent format before streaming, or use a filter-and-re-encode workflow. FFmpeg distinguishes the concat demuxer from the concat filter in its FAQ; the filter is appropriate when you need to re-encode and standardize inputs.

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.

Audio-only tracks and still images need additional mapping or generated video/audio options. The command below expects playlist entries that already provide compatible video and audio streams; it will not create missing streams automatically.

Choose YouTube-compatible output settings

The example command below encodes H.264 video and AAC audio. Select the resolution, frame rate, and bitrate based on the source material and your sustained upload capacity. YouTube’s current encoder guidance recommends constant bitrate (CBR), a two-second keyframe interval, and not exceeding four seconds between keyframes. Its bitrate table lists different values by codec and resolution: for 1080p at 30 fps, the H.264 recommendation is 10 Mbps, while the AV1 or H.265 range is 3–8 Mbps. Do not treat one codec’s figure as another codec’s target. See YouTube’s encoder settings and bitrate table.

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.
  • Keyframes: at 30 fps, a two-second GOP is 60 frames; at 60 fps, it is 120 frames. The sample uses -g 60 at 30 fps.
  • Audio: YouTube recommends 128 kbps for stereo AAC; the sample uses that bitrate and a 44.1 kHz sample rate.
  • Bandwidth: the sample’s 4,500 kbps video rate is illustrative, not a universal setting or YouTube recommendation. Adjust it for your resolution, frame rate, motion, and real connection headroom.
  • Compute: encoding consumes CPU or GPU resources depending on your FFmpeg build and selected encoder. If you cannot sustain real-time encoding, reduce the workload or use a compatible stream-copy workflow.

Start FFmpeg and send the stream

Replace the placeholder destination with the RTMPS server URL and stream key copied from YouTube. Treat the following as a starting example, not a universal tested recipe:

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 the file input at its normal playback speed.
  • -stream_loop -1 repeats the specified input indefinitely, as documented in the FFmpeg command documentation.
  • -f concat selects the concat demuxer. -safe 0 allows paths beyond the default safe subset; omit it when your relative paths work with the default safety checks.
  • -c:v libx264 and -c:a aac re-encode video and audio to common output codecs rather than assuming all playlist files can be joined unchanged.
  • -f flv formats the output for the ingest connection. The destination combines the server URL and key as provided for your stream.

For stream copy, substitute -c:v copy -c:a copy only if every input has compatible streams and parameters that the concat demuxer and YouTube accept. Test with the actual playlist; otherwise normalize or re-encode the files.

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

Verify the broadcast before leaving it unattended

  1. Run FFmpeg and watch its output for input errors, encoder exits, network errors, and dropped frames.
  2. Wait for the incoming preview in YouTube Live Control Room. Check both picture and sound, and review stream health.
  3. Start or confirm the broadcast according to the stream’s auto-start and auto-stop settings.
  4. Run a private or unlisted test and check that playback transitions correctly between playlist entries.
  5. Monitor the live stream after launch. YouTube’s streaming tips recommend testing the encoder, preview, stream quality, and failover where applicable.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What “24/7” requires beyond a looping command

-stream_loop -1 repeats an input; it does not supervise FFmpeg or provide power backup, internet failover, or guaranteed uninterrupted YouTube delivery. A local setup depends on the computer staying on, sufficient power and network service, readable media files, a running FFmpeg process, and YouTube ingest availability.

A service manager or watchdog can restart a failed process, but configure and test it separately. A restart may interrupt playback or require a new ingest session. If uninterrupted delivery is important, plan and test appropriate process, network, and power recovery rather than assuming an infinite loop provides it. YouTube recommends checking upload speed and selecting a bitrate the connection can sustain.

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.

Copyright, reused content, and archive limits

Only stream video and audio you have the rights or permissions to use. A playlist repeating around the clock does not grant permission to use copyrighted recordings, and a live broadcast can still be subject to YouTube’s copyright enforcement and monetization policies. Review YouTube’s current rules for your material and channel before streaming.

YouTube states that streams under 12 hours are automatically archived. That statement does not establish that an uninterrupted 24-hour stream will be archived in full. If you need a retained copy, record locally and check YouTube’s current long-stream archive behavior rather than relying on a full-day archive.

Common problems and fixes

  • FFmpeg rejects a playlist path: use safe relative paths first. If an absolute path is necessary, review the concat demuxer’s safe-path rules and only then consider -safe 0 for a trusted list.
  • The stream fails at a file boundary: check that entries have compatible codecs, stream layouts, time bases, and parameters. Normalize the files or use a filter/re-encode workflow, then test every transition.
  • YouTube shows no incoming preview: verify that the server URL and key came from the intended Live Control Room stream, that the key has not been reset, and that FFmpeg is still running. Keep the key private while checking it.
  • Video or audio is missing: the sample expects both in each input. Add explicit mapping or generate the missing stream for audio-only or image sources; do not expect the concat example to create it.
  • Encoding falls behind or drops frames: check host CPU/GPU load and sustained upload capacity. Reduce the encoding workload or bitrate as appropriate, while keeping settings compatible with YouTube’s current guidance.
  • The stream stops after a process or connection failure: the loop flag does not restart FFmpeg or restore connectivity. Inspect logs, restart the process or connection as needed, and test any watchdog or failover configuration separately.

Or let it run in the cloud

If you want the playlist to keep running without keeping a home computer on, StreamNeo is a cloud service for looping uploaded videos as a YouTube live stream. Upload your recording or build a playlist, add your YouTube stream key once, and go live. It keeps the stream running from the cloud and automatically recovers if YouTube drops it.

  • Nothing needs to stay powered on at home.
  • Every quality up to 4K 60fps streams as uploaded, at one flat price per slot; there are no quality tiers or re-encoding.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card required; one free day is available per account.
  • Monthly: $9.99 per month.

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

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.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.