Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Use FFmpeg `-stream_loop` with a YouTube Live Playlist

Use `-stream_loop -1` before the input’s `-i` to repeat a local file indefinitely. Learn where `-re` belongs and why YouTube HLS needs a different output workflow.
Length5 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To loop a local video indefinitely into a YouTube Live event, put -stream_loop -1 before that file’s -i, and use -re before the same input to pace file playback at its native frame rate. Then choose an output format and ingest URL that match the event’s selected YouTube ingest protocol. The command below is an illustrative RTMP-style shape, not a tested, universal configuration.

First, identify what “playlist” means

In this workflow, “playlist” can mean either a finite program assembled from several media files or an HLS .m3u8 manifest. Those are different input cases. -stream_loop repeats the input FFmpeg is given; the option does not establish that a changing live HLS playlist can be replayed as a finite program sequence.

  • One file: use the local media file as the input and loop that input.
  • A finite sequence of files: first represent the desired sequence as an input FFmpeg can consume as that sequence, then verify how that source behaves at its end before relying on repeated playback.
  • An HLS manifest: do not assume that adding -stream_loop -1 makes an evolving or live manifest repeatable. The loop option and the behavior of the playlist source are separate concerns.

Loop a local file into a typical RTMP-style YouTube Live event

For a local file and an RTMP-style ingest, the command shape is:

ffmpeg -re -stream_loop -1 -i input.mp4 
  -c:v libx264 -c:a aac 
  -f flv "YOUR_YOUTUBE_INGEST_URL/YOUR_STREAM_KEY"

Replace input.mp4 with the media file and replace the output placeholder with the ingest address and stream key shown for your YouTube Live event. Confirm the current protocol and settings in Live Control Room before starting. This example assumes RTMP-style FLV output; it is not appropriate for an event configured for HLS without a different, segment-based workflow.

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.

Why the option order matters

  • -stream_loop -1 is an input option: place it before the -i belonging to the input you want to repeat. -1 means loop indefinitely; 0 means do not loop.
  • -re reads a file input at its native frame rate (equivalent to -readrate 1). It is useful when pacing file playback for live-style output. It is intended for file-style inputs, so do not add it indiscriminately to a live capture or network stream.
  • The loop and pacing flags do not set a universally correct codec, bitrate, keyframe interval, or transport. Choose encoding and output options to match the source media and the ingest settings for the event.

Protect the stream key

Treat the stream key as a secret credential. Do not expose it in public scripts, screenshots, or logs. Use the key and ingestion address provided for the specific event, and avoid publishing a command containing the real key.

RTMP-style output and HLS are not interchangeable

The example above sends continuous FLV output to an RTMP-style destination. YouTube HLS ingest instead uses a media playlist and separate segments sent over HTTPS. Selecting HLS does not mean you can simply change the filename or append an HLS-looking extension to the example command.

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.
Decision RTMP-style file output YouTube HLS ingest
Output shape Continuous stream output, such as FLV/RTMP in the example A media playlist and separate media segments sent to YouTube
Latency Use the latency mode configured for the event YouTube describes HLS as higher latency; ultra-low latency is unavailable when HLS is selected
Playlist handling The FFmpeg input loop and output protocol are separate concerns YouTube requires rolling media playlists and ignores master playlists
Media and transport Match the current event’s ingest settings Meet the HLS playlist, segment, container, codec, and HTTPS requirements
When it fits A straightforward local-file loop into a typical live ingest When the HLS-specific workflow or requirements justify its added constraints

HLS requirements to account for

YouTube Help specifies HLS segments of 1–4 seconds, TS segment format, a rolling playlist with no more than five outstanding segments, HTTPS POST or PUT, and no encryption other than HTTPS. YouTube’s developer guide describes M2TS muxing, H.264 and HEVC video, frame rates up to 60 fps, closed GOP, and AAC audio. YouTube ingests Media Playlists; Master Playlists are ignored.

The HLS Help page’s audio-codec list differs from the developer guide. Check the current official settings and the specific HLS workflow rather than assuming the lists are interchangeable. HLS is segmented delivery, not a continuous RTMP-style connection, and YouTube says ultra-low latency is turned off for HLS.

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.

Check the source and event before going live

  1. Confirm the source type. Decide whether FFmpeg is reading one local file, a finite program sequence represented as an input, or an HLS manifest. Do not treat these as equivalent loop targets.
  2. Confirm the event’s ingest protocol. In YouTube Live Control Room, use the ingestion address and protocol selected for the event. An RTMP-style FLV output and an HLS workflow require different output handling.
  3. Match media settings. Check the source’s codecs and properties against the current settings for the chosen ingest mode. The loop flag does not determine encoding, bitrate, resolution, or keyframe spacing.
  4. Keep the key private. Use the event’s stream key in the command environment, but redact it anywhere the command may be shared or logged.
  5. Verify behavior at the end of the source. For a finite sequence or manifest, confirm what FFmpeg receives when it reaches the end or the playlist changes; the loop option alone does not guarantee seamless repetition.

Common problems and fixes

  • The file plays once and stops: check that -stream_loop -1 appears before the correct input’s -i.
  • Playback runs too quickly or is not paced as expected: for a file-based live output, place -re before that file’s -i. Do not apply it blindly to network or live-capture inputs.
  • YouTube does not accept the output: check that the output protocol, muxer, ingest address, and stream key match the event’s current Live Control Room configuration. The example is for RTMP-style FLV, not HLS.
  • An HLS manifest does not repeat like a video file: a changing HLS playlist is not necessarily a finite program input. Verify its source behavior; do not expect the loop flag to convert it into a replayable sequence.
  • HLS output is rejected or incomplete: check segment duration and format, rolling media-playlist behavior, HTTPS method, muxing, codecs, frame rate, and closed-GOP requirements against YouTube’s current HLS workflow.
  • A command or screenshot exposes the key: remove the exposed credential and replace or reset the key through the controls available for the event before using it again.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or let it run in the cloud

If the goal is a YouTube channel that keeps looping uploaded videos without leaving a computer running, StreamNeo handles the stream from the cloud: upload a recording or build a playlist, add your YouTube stream key once, and go live. No computer, OBS, or home connection has to stay on. It plays uploaded videos, not a live camera feed.

  • Each slot keeps one YouTube stream always on, with 24/7 looping and playlists.
  • Uploads stream as made, up to 4K 60fps, at one flat price per slot with no re-encode or quality tiers.
  • StreamNeo automatically recovers if YouTube drops the stream.
  • The first day is free with no card; it is one free day per account.

Monthly: $9.99 per month. Start your free day with StreamNeo.

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

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 quests from Patch Notes

  1. How To Create Custom Stickers & Shoutouts In Monster Hunter WildsMonster Hunter WildsBlog20min
  2. How to Get XL Gogoat in Pokemon Legends Z-A (An Extra-Large Gogoat)Pokemon Legends Z-ABlog20min
  3. How to Get Rotting Lightbringer in Diablo 4Diablo 4Blog17min
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.