October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan 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
concat demuxer

How to Create a Looping Video Playlist for a YouTube Livestream with FFmpeg

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

Use FFmpeg’s concat demuxer to list compatible local video files in playback order, then apply -stream_loop -1 to repeat that playlist and -re to send it at real-time speed. YouTube supplies the stream URL and key in Live Control Room. The method works best when every file has the same compatible streams, codecs and time bases; normalize mismatched files before relying on a long broadcast.

Before you begin

  • Your YouTube channel must be verified and must not have had live-streaming restrictions in the prior 90 days. See YouTube’s live-streaming eligibility guidance.
  • Install an FFmpeg build with the encoders you plan to use, such as libx264 for H.264. Check your build with ffmpeg -version and, if needed, ffmpeg -encoders.
  • Have local video files ready, enough disk space for any normalized copies, and an upload connection that can sustain the chosen video and audio bitrate.
  • Create a test stream or schedule time to test before the broadcast. A command-line stream has no automatic recovery plan if FFmpeg or the host stops.

1. Create or select a YouTube livestream

  1. Open YouTube Studio and go to Live Control Room. Create a stream or select one you have already configured.
  2. Copy the server URL and stream key shown in the stream settings. YouTube documents these controls under Manage live stream settings.
  3. Keep the key private, as you would a password. Do not put a real key in a script you share, publish, or commit to a repository. If it is exposed, use YouTube’s reset control and update your encoder configuration.

YouTube recommends RTMPS as the secure extension to RTMP. Use the exact ingest details displayed for your stream rather than assuming a server address.

2. Check that the playlist files are compatible

The concat demuxer joins files without decoding and re-encoding them, so it is not a general-purpose media converter. FFmpeg requires the inputs to have the same streams, codecs and time bases. Differences in resolution, frame rate, audio presence or codec can cause errors or bad transitions; inaccurate duration metadata or truncated inputs can also create gaps or artifacts. See the FFmpeg concat demuxer documentation.

When direct concatenation is suitable

Use the demuxer when the files have compatible stream layouts and media properties. This avoids the processing cost of re-encoding, but you should still test the transitions and inspect FFmpeg’s output for warnings.

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.

When files differ

Normalize the files to a common profile before using the playlist, including a consistent video codec, frame size, frame rate and audio layout. FFmpeg’s concat FAQ recommends the concat filter when concatenation requires re-encoding. A filter-based workflow takes more processing and needs a command tailored to the actual inputs; do not assume the demuxer will silently standardize them.

3. Write the playlist file

Create a plain-text file named playlist.txt in the directory from which you will run FFmpeg. Put one file entry on each line in the order you want the videos to play:

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.
file '/path/to/first.mp4'
file '/path/to/second.mp4'
file '/path/to/third.mp4'

Replace these sample paths with the real local paths. The concat demuxer has its own quoting and escaping rules, so paths containing apostrophes or other special characters need to be escaped according to FFmpeg’s documentation. Confirm every path exists before starting a public stream.

4. Start FFmpeg and loop the playlist

This is an illustrative 1080p30 H.264/AAC starting point, not a tested command for your files or FFmpeg build. Substitute the exact server URL and stream key from Live Control Room:

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.
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.
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt 
  -c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://SERVER_URL/STREAM_KEY'
  • -re paces file input for real-time output rather than sending it as fast as the computer can read it.
  • -stream_loop -1 requests indefinite repetition of the input playlist. It is an input option, so place it before the -i it applies to.
  • -f concat -safe 0 -i playlist.txt reads the playlist script. -safe 0 permits paths that the demuxer’s default safety checks may reject; use it only with a playlist you control and have validated.
  • -c:v libx264 and -c:a aac encode video and audio in a common SDR streaming combination. The veryfast preset trades compression efficiency for lower encoding complexity.
  • -b:v sets the video bitrate; -maxrate and -bufsize constrain rate behavior. The example’s 5 Mbps video setting is a YouTube recommendation for H.264 at 1080p30, not a universal target.
  • -r 30 sets the output frame rate. -g 60 and -keyint_min 60 target a two-second keyframe interval at 30 fps; -sc_threshold 0 disables scene-cut keyframes so the interval remains regular.
  • -b:a 128k -ar 44100 set the AAC audio bitrate and sample rate for this example. Confirm the result sounds right and that the source audio is present and consistent.
  • -f flv packages the encoded feed for RTMP/RTMPS ingest. Keep the destination private because it contains your stream key.

YouTube’s encoder guidance currently lists RTMP/RTMPS and supports H.264, H.265 or AV1 video with AAC or MP3 audio, up to 60 fps, depending on the protocol and stream settings. It recommends CBR and a two-second keyframe frequency that should not exceed four seconds. The guidance lists 14 Mbps for H.264 at 1080p60, compared with 5 Mbps at 1080p30. Check YouTube’s current encoder settings, bitrates and resolutions for the resolution and frame rate you choose; these recommendations do not guarantee a stable stream if your connection cannot sustain the bitrate.

5. Test and monitor the broadcast

Before depending on a long stream, test with audio and video movement similar to the planned broadcast, as YouTube recommends. Watch the Live Control Room preview and stream-health messages while checking the video, audio level, transitions between files, FFmpeg logs and upload stability.

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
  • Confirm that the preview appears and the correct stream is receiving the feed.
  • Listen for silence, clipped audio or abrupt changes in loudness between clips.
  • Check that each transition works and that playback returns to the first file after the last one.
  • Watch for encoder errors, dropped frames or repeated reconnects, and lower the output demand if the upload connection cannot sustain it.

A terminal command by itself does not supervise the operating system, restart a failed process, monitor disk space or verify stream health indefinitely. Those safeguards depend on your host environment. For unattended operation, decide how the process will be restarted and how you will detect a stopped or unhealthy stream.

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

Common problems and fixes

Symptom Likely cause What to check
FFmpeg cannot open a playlist file Wrong working directory, misspelled path or quoting/escaping problem. Use an absolute path for playlist.txt and each media file; validate special characters against the concat demuxer syntax.
Concat errors or broken transitions Inputs do not have compatible streams, codecs or time bases, or a file is truncated or has inaccurate duration metadata. Inspect the files, make their streams compatible, or use a concat-filter workflow that re-encodes to a common profile.
FFmpeg exits after starting Unavailable encoder, invalid option for the installed build, unreadable input, or rejected destination details. Read the first relevant error in the FFmpeg log; check encoder availability and replace the sample destination with the exact current ingest URL and key.
YouTube preview is blank or shows an ingest error Incorrect server URL or key, stream not configured as expected, or incompatible output settings. Recheck Live Control Room details and the selected protocol, codec and frame rate; reset a compromised key.
Buffering, dropped frames or unstable health Bitrate exceeds reliable upload capacity, or encoding/host resources cannot keep up. Test upload bitrate, reduce resolution, frame rate or bitrate, and test again before the live broadcast.
Playlist loops but the stream later stops The FFmpeg process, host or network stopped; looping does not provide process supervision or recovery. Check host availability, logs, disk space and restart handling, then verify stream health after recovery.

Copyright and monetization considerations

A technically valid playlist is not automatically eligible for a public broadcast or monetization. Use footage and music you own or have permission to stream, and check the applicable rights for every item. YouTube’s live-stream restrictions and monetization decisions are separate from FFmpeg’s ability to play the files. Repeatedly looping material does not itself establish rights or make a channel eligible for monetization. Review YouTube’s live-streaming requirements and the channel’s applicable policy notices before broadcasting.

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.
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 you want the uploaded playlist to keep streaming to YouTube without leaving a computer running at home, StreamNeo runs the loop in the cloud: upload your video or build a playlist, add your YouTube stream key once, then go live. Nothing has to stay on at home; it plays uploaded videos, not a camera feed. One flat price per slot covers any uploaded quality up to 4K 60fps without re-encoding or quality tiers. It can automatically recover if YouTube drops the stream. The first day is free with no card, one free day per account. Monthly pricing is $9.99 per month. Start your free StreamNeo day.

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
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.