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
FFmpeg

How to Configure FFmpeg to Loop a Video File into YouTube Live Nonstop

A practical FFmpeg template for looping a video into YouTube Live, with RTMPS setup, keyframe and bitrate guidance, testing steps, and troubleshooting.

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

To loop a video file into YouTube Live, put -stream_loop -1 before the input file and use -re to read it at real-time speed. Send the output to the RTMPS URL and stream key shown in YouTube Live Control Room. The command below is a starting template: match its encoding settings to your video and YouTube’s recommendations, then test and monitor the stream.

Use this FFmpeg command as a starting point

ffmpeg 
  -stream_loop -1 -re -i input.mp4 
  -c:v libx264 -pix_fmt yuv420p -r 30 -g 60 
  -b:v 5M -maxrate 5M -bufsize 10M 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://<server>/<stream-key>'

-stream_loop -1 tells FFmpeg to repeat the input indefinitely; it belongs before -i input.mp4. -re reads the file at its native rate rather than sending it as fast as the machine can process it. The output is encoded as H.264 video and AAC audio, then packaged as FLV for the RTMPS destination.

This is an illustrative template, not a tested command for every file, FFmpeg build, or YouTube account. Replace input.mp4 with your file and the destination with the RTMPS URL and key from your stream’s Live Control Room settings. Never put a real stream key in a public script, screenshot, or article.

What the example’s numbers mean

The example targets 1080p at 30 fps with H.264. YouTube’s current encoder guidance recommends 5 Mbps for H.264 at 1080p30, and recommends a two-second keyframe interval. At 30 fps, -g 60 requests a GOP of 60 frames, or two seconds if the encoder honors the frame rate. The 5 Mbps value is not universal: choose bitrate, resolution, and frame rate for your actual target and codec.

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.

The audio options request AAC at 128 Kbps and 44.1 kHz stereo. YouTube lists AAC or MP3 and gives stereo guidance of 44.1 kHz and 128 Kbps. Its encoder guidance also recommends constant bitrate (CBR), progressive scan, square pixels, and Rec. 709 for SDR. Check the relevant YouTube encoder settings and bitrate table for the chosen codec, resolution, and frame rate.

Set up YouTube Live and protect the stream key

  1. In YouTube Studio, open Live Control Room and create a stream or select the stream you plan to use. Copy its stream URL and stream key into your local FFmpeg configuration. The key functions like a password: anyone who gets it may be able to send a stream to that destination.
  2. Use the secure RTMPS URL where possible. YouTube says the ordinary RTMP URL may appear by default; use the lock control in Live Control Room to reveal the RTMPS URL. RTMPS is RTMP carried over TLS/SSL, and YouTube recommends it for encrypted transport. See YouTube’s RTMPS guidance.
  3. Check your installed FFmpeg build’s options and encoders, then inspect the input file’s video and audio streams. Available options and encoder names depend on how FFmpeg was built; confirm them locally rather than assuming a particular installation.
  4. Replace the example resolution, frame rate, bitrate, GOP, and audio settings as needed. Keep the outgoing bitrate within YouTube’s recommendation for the selected format and ensure your upload connection can sustain it.
  5. Test with an unlisted stream or another appropriate test setup. Check picture, audio, stream health, and YouTube’s messages. A running FFmpeg process alone does not prove that YouTube is receiving a healthy stream.

Choose between re-encoding and stream copy

The example re-encodes the video and audio. This gives you control over output parameters, but encoding consumes CPU or hardware-encoder resources. If the input’s codecs and parameters already match your chosen YouTube ingest settings, stream copy may reduce CPU use. It does not convert incompatible media, and the available evidence does not establish whether any particular file can be copied cleanly across its loop boundary. Inspect the file and test the exact command before relying on it.

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.

There is no universal best setting without knowing the file, target quality, FFmpeg build, and available upload bandwidth. YouTube lists H.264, H.265/HEVC, and AV1 for video, with frame rates up to 60 fps. Match the selected codec and format to the bitrate guidance and what your source and encoder can actually produce.

What “nonstop” does—and does not—guarantee

The loop option repeats the input; it does not guarantee an uninterrupted public broadcast. Encoder load, file characteristics, network availability, YouTube ingest health, account settings, and operator actions can all affect continuity. No controlled benchmark establishes a typical CPU load or reliability rate for this use case. Test the actual setup and watch YouTube’s stream-health panel.

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

Continuous looping also should not be confused with unlimited archiving. YouTube’s encoder setup page says streams under 12 hours are automatically archived. Do not assume a longer uninterrupted broadcast will be saved as one complete video; plan monitoring and any separate archive needs around that documented limit. See YouTube’s encoder setup instructions.

Troubleshooting common problems

  • YouTube does not receive the stream: Recheck the destination URL and stream key in Live Control Room, confirm that the key has not been changed, and verify that the selected RTMP/RTMPS endpoint is supported by your FFmpeg build and command.
  • The stream starts but YouTube reports poor health: Compare codec, resolution, frame rate, bitrate, keyframe interval, and audio format with YouTube’s current guidance. Check whether the upload connection can sustain the configured bitrate.
  • FFmpeg cannot find an encoder or rejects an option: Confirm the installed build’s available encoders and options. Build configuration varies, so an encoder name in an example may not exist on every system.
  • High CPU use or unstable output: Re-encoding can be demanding. Test lower output settings or use stream copy only if the input already matches the ingest requirements; do not assume that copying will work across the file’s loop boundary.
  • Audio is missing or unsuitable: Inspect whether the input contains an audio stream, then ensure the output codec and sample rate match your intended settings. Confirm audible sound during a test rather than relying only on FFmpeg’s exit status.
  • The stream stops when the computer or network goes offline: This command runs on the machine where FFmpeg is launched and depends on that machine and its connection. For unattended operation, arrange a reliable always-on host, monitor the process, and test recovery procedures.
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 you do not want a computer or home connection to stay on, StreamNeo keeps an uploaded video or playlist looping to YouTube from the cloud. Upload your recording, add your YouTube stream key once, and go live. Nothing has to stay on at home; it streams the uploaded quality up to 4K 60fps at one flat price per slot, automatically recovers if YouTube drops the stream, and the first day is free with no card. The monthly option is $9.99 per month. It plays uploaded videos rather than going live from a camera and streams to YouTube only. 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 *

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.

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
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.