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
VGSources
Concat Demuxer

How to Loop a Video on YouTube Live with FFmpeg’s Concat Demuxer

A practical guide to looping one video or a compatible playlist on YouTube Live with FFmpeg’s concat demuxer, including setup, settings, testing and fixes.

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

To loop a local video on YouTube Live with FFmpeg, put it in an ffconcat playlist, pass that playlist to FFmpeg’s concat demuxer, and use -stream_loop -1 to repeat it indefinitely. Add -re so FFmpeg reads the file at its normal playback rate, then encode and send the feed to the RTMPS URL and stream key shown in YouTube Live Control Room.

The example below is a starting point, not a universal preset: choose resolution, frame rate, codec and bitrate for your source and YouTube’s current encoder guidance. For a playlist, the files must have compatible streams and timing.

1. Check the files and prepare FFmpeg

Confirm your FFmpeg build

Install FFmpeg for your operating system, then run:

ffmpeg -version

Confirm that the build has the encoder you intend to use (the example uses libx264) and supports the FLV output muxer. Build options differ, so an unavailable encoder or option may require a different FFmpeg build or encoder.

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

Check every playlist file

The concat demuxer creates a virtual input from a text script rather than joining files into a new file. FFmpeg requires the inputs to have matching streams, codecs and time bases, among other properties. Compare video and audio stream counts, codecs, dimensions, frame rates and time bases before adding multiple files. If they do not match, normalize or transcode them to compatible streams first; FFmpeg’s FAQ describes the concat filter as the option when re-encoding is needed. See FFmpeg’s concat demuxer documentation and FFmpeg’s FAQ.

2. Create the concat playlist

Save a UTF-8 plain-text file named playlist.ffconcat. Its first line must be exactly ffconcat version 1.0. Then add one file directive for each item, in the order you want them played:

ffconcat version 1.0
file '/path/to/video.mp4'
file '/path/to/second-video.mp4'

Replace the example paths with your own. Follow FFmpeg’s playlist quoting and escaping rules for spaces or special characters. The example command uses -safe 0 to allow paths beyond the safe subset; use it only with a playlist you control, never with untrusted paths.

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.

Handle inaccurate durations

The demuxer relies on duration information to place later files on the timeline. Incorrect or truncated duration metadata can cause gaps, timestamp shifts or artifacts at a boundary. If inspection shows a duration is inaccurate, the playlist format supports a duration directive to provide the correct duration for that file.

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

3. Set up the YouTube live event and protect its key

  1. Enable live streaming on your YouTube channel if it is not already enabled. YouTube says first-time live-stream enablement can take up to 24 hours; allow for that before a scheduled broadcast. See YouTube’s encoder setup instructions.

  2. Open Live Control Room, create or select the live event, and copy its RTMPS stream URL and stream key. YouTube recommends RTMPS. The key is a credential: YouTube describes stream keys as “like your YouTube stream’s password and address.” Do not publish it, include it in a shared screenshot, or commit it to a public script repository. If it is exposed, reset it in YouTube. See YouTube’s RTMPS guidance and stream settings and key guidance.

    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.
  3. Check that the video and audio you plan to broadcast are yours to use or otherwise authorized, and that the content follows YouTube’s policies. A successful encoder connection does not establish copyright permission or guarantee monetization eligibility.

4. Choose output settings for the source and YouTube

YouTube’s current encoder guidance covers RTMP/RTMPS, H.264, HEVC or AV1, frame rates up to 60 fps, CBR, and AAC or MP3 audio. It recommends keyframes every 2 seconds and says not to exceed 4 seconds. The bitrate table varies by codec, resolution and frame rate; use the current table rather than treating an example value as a universal requirement. See YouTube encoder settings and bitrate guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Resolution and frame rate: select an output your encoder and upload connection can sustain. If you change frame rate or resolution while encoding, ensure the bitrate fits YouTube’s guidance for that output.
  • Bitrate: YouTube lists 5 Mbps minimum and 14 Mbps recommended for H.264 at 1080p30. These are platform recommendations, not independent performance results. Other combinations have different entries in its table.
  • Keyframes: set the GOP to about two seconds of output. For fixed-frame-rate output, multiply the frame rate by two to get the approximate GOP length in frames. For example, 30 fps uses about 60 frames; 60 fps uses about 120. Do not use a fixed -g 60 at every frame rate.
  • Upload capacity: make sure the available upstream bandwidth can sustain the selected video and audio bitrate. Leave capacity for normal network variation; monitor YouTube’s stream-health feedback during a test.
  • Protocol: this guide uses RTMPS with FLV output. YouTube also documents HLS for some workflows, but its configuration and latency behavior differ and are not covered here.

5. Start the looping FFmpeg stream

Replace the playlist path, RTMPS URL and stream key with your own values. This illustrative command encodes H.264 video and AAC audio and is set up for a 30 fps-style GOP:

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
ffmpeg -stream_loop -1 -re -f concat -safe 0 -i playlist.ffconcat 
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://STREAM_URL/STREAM_KEY'

The sample’s 4500k video bitrate is not a recommended setting for every output. Select bitrate from YouTube’s table for the actual codec, resolution and frame rate, and change the GOP settings if your output frame rate is not 30 fps. The sample also does not force a resolution or frame rate, so output characteristics depend on the input and FFmpeg’s processing. Add explicit output settings only when you have chosen values suitable for your source and YouTube’s guidance.

  • -stream_loop -1 repeats the input indefinitely.
  • -re reads file input at its native rate, which is useful for live output.
  • -f concat selects the concat demuxer; -i playlist.ffconcat supplies the script.
  • -safe 0 relaxes path restrictions; omit it when your playlist uses only safe paths and it is not needed.
  • -g sets the GOP length in frames; calculate it from the output frame rate and desired keyframe interval.
  • The RTMPS destination must be the exact URL and key from Live Control Room. Keep the key out of logs or shared command histories where possible.

FFmpeg treats -stream_loop and -re as input options, so place them before the corresponding -i. Check the syntax against the documentation for your installed build: FFmpeg command-line documentation.

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

6. Test the feed and monitor it

  1. Start the command while the YouTube event is ready to receive the feed.

    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.
  2. Check the event preview for picture, audio, motion and continuity, including the transition where one playlist item hands off to the next. YouTube recommends testing with audio and movement similar to the actual stream.

  3. Review YouTube’s stream-health messages and adjust the encoder or network if it reports problems. A connected encoder alone does not confirm that every viewer will receive a stable feed.

  4. Keep the FFmpeg process, machine and network connection running for the entire broadcast. If the process or local connection stops, this do-it-yourself setup stops sending the feed.

YouTube’s setup guidance says streams under 12 hours are automatically archived. Do not assume the same archival behavior for a broadcast that runs longer than 12 hours.

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

7. Troubleshoot common problems

Symptom Likely cause What to check or do
FFmpeg refuses the playlist or a file fails at the boundary Input streams, codecs or time bases differ, or the file list/path syntax is wrong. Check the playlist’s first line and paths, then compare each input’s streams and time bases. Normalize the inputs or use a filter-based re-encode workflow if they do not match.
Gap, jump or visual/audio artifact between items Duration metadata is inaccurate, or a source is truncated or has incompatible timing. Inspect the file durations and stream timing. Use a correct duration directive when needed, or prepare compatible source files before concatenation.
FFmpeg cannot connect to YouTube Incorrect endpoint or key, wrong protocol, or a TLS/network issue. Copy the RTMPS URL and key again from Live Control Room. For RTMPS TLS connection errors, YouTube’s guidance suggests checking the exact RTMPS URL and port 443.
Buffering or poor picture quality Selected bitrate does not suit the output or exceeds available upload capacity. Use the bitrate entry for the chosen codec, resolution and frame rate in YouTube’s current table; verify upstream capacity and review stream-health messages.
Keyframes arrive at the wrong interval The GOP frame count was chosen for a different frame rate. Calculate GOP frames from the actual output frame rate: approximately frame rate × interval in seconds. Target 2 seconds and do not exceed 4 seconds under YouTube’s guidance.
Options or encoder are reported as unknown The installed FFmpeg build differs from the example or lacks that encoder. Check ffmpeg -version and available encoders, then adapt the command to the capabilities of that build.

Or let it run in the cloud

If you want the loop to keep running without leaving a computer and home connection on, StreamNeo runs uploaded videos as a 24/7 YouTube stream from the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded videos, not a live camera feed.

  • Nothing has to stay on at home once the cloud stream is running.
  • Any uploaded quality up to 4K 60fps streams as made, at one flat price per slot, without re-encoding or quality tiers.
  • It automatically recovers if YouTube drops the stream.
  • The first day is free with no card required, once per account.
  • Monthly service 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.

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.