Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check 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
DocumentaryTube
Admit one · Blog

Best FFmpeg Commands for Looping Videos to YouTube Live

A practical FFmpeg template for looping prerecorded video to YouTube Live, with option order, YouTube-aligned encoding settings, RTMPS setup, and troubleshooting.
Opened Runtime6 min Written byDocumentaryTube Team

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.

To loop a prerecorded video to YouTube Live with FFmpeg, put -stream_loop -1 before the input file and use -re to pace playback in real time. For a local MP4 with video and audio, this adaptable H.264/AAC template is a starting point:

ffmpeg -re -stream_loop -1 -i input.mp4 
  -c:v libx264 -preset veryfast 
  -b:v 5M -maxrate 5M -bufsize 10M 
  -pix_fmt yuv420p -g 60 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmp://YOUR_SERVER/YOUR_STREAM_KEY"

Replace input.mp4 with the file path and replace the destination with the exact server URL and stream key shown in YouTube Live Control Room. Use YouTube’s RTMPS URL when your FFmpeg build and destination configuration support it. Keep the stream key private. This is a template, not a tested command: confirm your FFmpeg build, input’s audio and video, resolution, frame rate, available encoding resources, upload capacity, and current Live Control Room settings before broadcasting.

What the command does—and where options go

  • -re reads the prerecorded file at its native frame rate, equivalent to FFmpeg’s -readrate 1. This simulates a live input instead of sending the file as fast as the machine can read it. Do not apply it blindly to a capture device or other live input: FFmpeg warns that a low read rate on a real-time source can cause packet loss. FFmpeg documentation
  • -stream_loop -1 loops the input indefinitely. It is an input option, so place it before the relevant -i. FFmpeg options generally apply to the next input or output, making order significant. FFmpeg documentation
  • -i input.mp4 selects the input file. The example assumes one file containing both video and audio; files with no audio need a different audio setup.
  • -c:v libx264 encodes video as H.264; -c:a aac encodes audio as AAC; and -pix_fmt yuv420p selects a widely used pixel format. These are choices for this example, not the only formats YouTube accepts: YouTube currently lists H.264, H.265, and AV1 for RTMP/RTMPS ingestion, and AAC or MP3 audio. YouTube encoder settings
  • -preset veryfast is an illustrative, compatibility-oriented x264 preset. Its encoding quality and CPU cost depend on the material and machine.
  • -f flv selects an output format commonly used in FFmpeg RTMP examples. Treat it as part of this practical command pattern, not as a universal YouTube requirement; YouTube’s cited guidance specifies RTMP/RTMPS rather than mandating FLV. YouTube encoder settings

Set bitrate and keyframes for the source video

The example’s 5M video rate is not right for every resolution and frame rate. YouTube’s settings page, accessed in 2026, recommends H.264 video at 5 Mbps for 1080p at 30 fps and 8 Mbps for 720p at 60 fps; its table gives distinct rates for other combinations and codecs. Choose the applicable current recommendation, then verify that your upload connection has headroom. YouTube recommends running a speed test and testing representative audio and video motion. YouTube encoder settings

-maxrate 5M and -bufsize 10M are example rate-control values, not universal settings. Adjust them with the target video rate and the encoder’s requirements; do not assume the example suits a higher resolution, frame rate, or different 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.

-g 60 sets the GOP/keyframe interval in frames. YouTube recommends a keyframe frequency of two seconds and says not to exceed four seconds. At 30 fps, 60 frames equal two seconds; for 60 fps, use 120 frames for the same interval. YouTube encoder settings

Set audio to match the stream

The sample’s -b:a 128k -ar 44100 selects 128 Kbps AAC audio at 44.1 kHz, matching YouTube’s current recommendations for stereo. YouTube lists 48 kHz for 5.1 audio and recommends 384 Kbps for that channel layout. Confirm whether the file is stereo or 5.1 before choosing audio settings. YouTube encoder settings

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.

Copy streams instead of re-encoding?

Stream copying can avoid re-encoding, but whether it works depends on the source codecs, timestamps, and ingest requirements. No single copy command is established as suitable for every file in this workflow. The H.264/AAC template above gives control over codec, bitrate, pixel format, and keyframe interval, at the cost of CPU or other encoding resources; re-encoding can also affect quality. Use copying only when you have checked that the source streams and timing are suitable for the destination.

Get YouTube’s current server URL and stream key

  1. Open YouTube Live Control Room and go to the stream’s Stream settings.
  2. Reveal the RTMPS URL using the lock icon, then copy the URL and stream key into the FFmpeg output destination. YouTube describes RTMPS as RTMP over TLS/SSL and recommends it. YouTube RTMPS help
  3. Start FFmpeg and wait for the preview in Live Control Room. For a scheduled stream, YouTube’s encoder setup instructions say to click Go live in Live Control Room. YouTube encoder setup

If you see an SSL error, check that the scheme and server use rtmps. YouTube also suggests specifying port 443 if needed. Never expose the key in a public command, screenshot, log, or repository; anyone with access to it may be able to broadcast to your channel. YouTube RTMPS help

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.

What a 24/7 loop does—and does not—guarantee

-stream_loop -1 tells FFmpeg to repeat the input; it does not supervise the FFmpeg process, keep a network connection alive, or recover automatically from a server or network failure. A long-running broadcast needs monitoring and a separate restart or process-supervision plan. Check both FFmpeg’s process and YouTube’s stream health rather than assuming an endless loop means an uninterrupted stream.

YouTube’s encoder setup page says streams under 12 hours are automatically archived. Do not assume the same archive behavior for a broadcast longer than 12 hours based on that statement alone. YouTube encoder setup

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common problems

  • FFmpeg says it cannot open the input: check the file path, spelling, permissions, and whether the file exists where the command runs. Use a quoted path if it contains spaces.
  • The stream reaches YouTube too quickly or playback is not paced: confirm -re appears before the file’s -i. It is for prerecorded media, not a live capture input.
  • The video does not loop: verify -stream_loop -1 appears before the corresponding -i, and confirm FFmpeg is still running.
  • YouTube does not receive the stream: copy the current server URL and key from Live Control Room, check the destination for typos, and make sure the key has not been replaced. Keep the key secret.
  • An SSL connection fails: use the RTMPS scheme and server shown in Live Control Room; if needed, check YouTube’s guidance to specify port 443. YouTube RTMPS help
  • The stream is unstable or YouTube reports poor connection: compare the selected bitrate with YouTube’s current recommendation for the chosen codec, resolution, and frame rate, and check upload capacity with a speed test. Leave headroom rather than setting the stream rate at the full measured upload rate. YouTube encoder settings
  • Encoding overload or poor output quality: re-encoding uses machine resources. Check the actual source resolution and frame rate, encoder load, bitrate choice, and preset; veryfast is an example, not a guaranteed best setting.
  • FFmpeg rejects an option: check ffmpeg -version and the installed build’s ffmpeg -h output. FFmpeg’s nightly documentation may not match an older installed version. FFmpeg documentation

Or let it run in the cloud

For a YouTube channel that needs prerecorded videos looping without an always-on home computer, StreamNeo runs the stream from the cloud: upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded video to YouTube; it does not broadcast from a camera.

  • Your computer and home connection do not have to stay on.
  • Every slot streams the uploaded file as made, up to 4K 60fps, at one price per slot, with no re-encode or quality tiers.
  • Automatic recovery is included if YouTube drops the stream.
  • The first day is free, with no card required; one free day is available per account.

Each slot includes one always-on stream, 10 GB storage per slot (pooled across active slots), 24/7 looping and playlists, automatic recovery if YouTube drops, and StreamNeo team support. The same product is included on every plan; only the billing length changes. Plans can be paid by day, week, month, six months, or year, and can be cancelled any time. UPI and cards are available in India; card checkout is available worldwide. For five or more slots, contact support. See StreamNeo for details.

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.

Monthly pricing: $9.99 per month.

Start your free first day with StreamNeo.

Copyright and YouTube policy checks before looping

Before putting a recording on repeat, confirm that you have the rights and permissions needed for every video, music track, image, and other included material. A live loop does not make copyrighted material yours or exempt it from YouTube’s rules. Check YouTube’s current policies and your channel’s Live Control Room notices before going live; the settings and command here address delivery, not permission to rebroadcast content.

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 the Screening Room

  1. How to Migrate a 24/7 YouTube Stream to a New VPSAdmit one · BlogHow to Migrate a 24/7 YouTube Stream to a New VPSOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Playlist on a Headless Linux Server—and Broadcast It LiveAdmit one · BlogHow to Run a YouTube Playlist on a Headless Linux Server-and Broadcast It LiveOpened04 OCT 2026Runtime6 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
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.