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 DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
DocumentaryTube
Documentaries

How to Loop a Pre-Recorded Video on YouTube Live with FFmpeg

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

To loop a video on YouTube Live with FFmpeg, use -stream_loop -1 to repeat the input forever and -re to read it at normal playback speed, then send the encoded output to the stream URL and key from YouTube Live Control Room. The command below is a starting point for a 1080p30 H.264/AAC stream; test it privately or as unlisted before relying on it for a broadcast.

What you need before starting

  • An FFmpeg build that can read your video and encode H.264 with libx264, plus AAC audio.
  • A video file you have the right to broadcast.
  • A YouTube channel eligible to live stream. YouTube says channels must be verified and have no live-streaming restrictions in the previous 90 days; its current eligibility guidance also sets the minimum age to live stream at 16. See YouTube’s live-streaming eligibility guidance.
  • The stream URL and stream key for the selected broadcast, copied from Live Control Room. Keep the key private: YouTube describes stream keys as password-like credentials. See YouTube’s encoder setup instructions.
  • A stable upload connection with enough capacity for the video bitrate and headroom for normal network variation.

Set up the YouTube stream

  1. In YouTube Studio, open Live Control Room and create or select the live stream you intend to use.
  2. Copy the stream URL and stream key shown for that stream. Treat the key as a password; do not place it in a public script repository, screenshot, or chat.
  3. Use Live Control Room’s preview to confirm FFmpeg is reaching YouTube. For a scheduled stream, select Go live after the preview is ready. Starting FFmpeg sends the feed, but it does not necessarily make the broadcast public by itself.

Run FFmpeg with an infinite input loop

Replace the file path, ingest URL, and key below with your own values:

ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -c:v libx264 -preset veryfast -b:v 14M -minrate 14M -maxrate 14M -bufsize 28M -g 60 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmp://YOUR_INGEST_URL/YOUR_STREAM_KEY"

-stream_loop -1 is an input option; FFmpeg defines -1 as infinite looping. -re reads the input at its native pace, which is useful when sending file content to a live output. Both options appear before -i because FFmpeg options generally apply to the next input or output file. The loop repeats the file from its beginning; it does not create new footage or alter the source.

What the encoding settings mean

  • -c:v libx264 selects H.264 video encoding, and -preset veryfast trades some compression efficiency for less encoding work.
  • -b:v 14M sets the target video bitrate. The sample follows YouTube’s recommendation for H.264 at 1080p30; YouTube lists 5 Mbps as the minimum for that format. These are YouTube recommendations, not guarantees that a particular connection or source will work.
  • -minrate 14M -maxrate 14M set equal minimum and maximum rates for a CBR-style configuration. YouTube recommends CBR.
  • -bufsize 28M sets the encoder buffer value in this example.
  • -g 60 sets a 60-frame GOP. At 30 frames per second, that is a two-second keyframe interval. YouTube recommends a two-second keyframe frequency and says not to exceed four seconds.
  • -c:a aac -b:a 128k -ar 44100 encodes AAC audio at 128 kbps and 44.1 kHz.
  • -f flv selects FLV output for the RTMP-style ingest address in the example.

See YouTube’s encoder settings, bitrates, and resolutions for its codec and bitrate recommendations. YouTube recommends RTMPS for encrypted transport when supported by the ingest workflow; use the secure ingest address supplied for your stream if available, rather than assuming every stream uses the example’s RTMP address.

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.

Adjust quality to the source and connection

The command is a template, not a tested configuration for every file, FFmpeg build, or computer. Its bitrate and GOP assume a 30 fps 1080p output. If your source has a different frame rate, unusual audio, or does not encode cleanly, adjust the output settings while preserving YouTube’s applicable recommendations. In particular, -g 60 means two seconds only at 30 fps; set the GOP to approximately two seconds’ worth of frames for a different output frame rate.

For H.264 at 1080p30, YouTube’s current encoder-settings guidance lists a recommended 14 Mbps video bitrate and a 5 Mbps minimum. A lower resolution can be a better fit when upload capacity is limited; use the bitrate recommendation for the resolution and frame rate you actually output. YouTube’s streaming tips recommend allowing approximately 20% more upload bandwidth than the total streaming bitrate and testing before broadcast. Check YouTube’s streaming tips and the encoder-settings page for current guidance.

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.

Test, publish, and stop the broadcast

  1. Run the command and wait for the incoming feed to appear in Live Control Room.
  2. Inspect the preview for audio, motion, framing, and unexpected black frames or silence. Check YouTube’s stream health while the test is running.
  3. Use a private or unlisted test before a public broadcast. YouTube recommends testing and monitoring the stream, with upload bandwidth headroom.
  4. When the preview and stream health look right, use Go live in Live Control Room if the scheduled stream requires it.
  5. To finish, stop the FFmpeg process and end the broadcast in Live Control Room as appropriate for the stream’s settings. Follow YouTube’s encoder workflow for the stream/encoder stop sequence.

Copyright and documentary footage

Only loop footage and audio you are allowed to broadcast. A video being prerecorded, publicly viewable, or documentary in style does not by itself establish that you have permission to rebroadcast it. Check rights for every component, including music, archival clips, narration, and images, and review YouTube’s applicable policies before scheduling a long-running stream. A stream can have valid technical settings and still be interrupted or restricted for rights or channel-policy reasons.

Troubleshooting common failures

No preview appears in Live Control Room

  • Check that the URL and key belong to the selected stream and were copied without missing characters or extra spaces.
  • Confirm the channel is eligible to live stream and that FFmpeg is still running without an input or connection error.
  • Keep the stream key private; if it may have been exposed, replace it in Live Control Room and update the command.

The stream buffers or reports poor health

  • Compare available upload capacity with the total streaming bitrate and leave the approximately 20% margin YouTube recommends.
  • Lower the output resolution or bitrate to match the connection, then test again. Do not assume the sample’s 14 Mbps is right for another resolution or frame rate.
  • Check the connection and monitor stream health rather than relying only on FFmpeg continuing to run.

Video or audio does not encode as expected

  • Confirm the FFmpeg build includes the requested encoders and can read the input file.
  • If the file has unusual audio or a different frame rate, adapt the output settings and check the preview before going public.
  • Verify that the keyframe interval corresponds to the output frame rate; the sample’s 60 frames represent two seconds at 30 fps.

The stream reaches YouTube but is not public

FFmpeg sending a feed and YouTube publishing the broadcast are separate steps. Check the preview, then use Live Control Room’s Go live control when required by the selected stream setup.

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

For a YouTube channel that needs prerecorded video to keep looping without leaving a computer on, 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 videos, not a live camera feed, and streams to YouTube only.

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
  • Nothing has to stay on at home: the stream runs in the cloud, so your computer and home connection do not have to remain on.
  • Every slot streams the upload as made, up to 4K 60fps, at one flat price per slot with no quality tiers or re-encode.
  • Automatic recovery is included if YouTube drops the stream.
  • The first day is free with no card; one free day is available per account.
  • Monthly: $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
Crashes, No Sound, or Screen Glitches?Free driver scan
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.