To repeat one local video file in a YouTube Live broadcast, use FFmpeg’s -stream_loop -1 input option before the file’s -i, and use -re to pace playback in real time. YouTube still has to receive a compatible, stable stream: create or select a Live event, use its server URL and stream key, check the preview, and click Go live for a scheduled stream. The command below is a starting point, not a guarantee of a working broadcast.
How to loop a video on YouTube Live with FFmpeg
First confirm that FFmpeg can read your file and that you have a YouTube Live event ready. Then start FFmpeg with -re and -stream_loop -1 before the input file. The example transcodes video to H.264 and audio to AAC, then sends the output using RTMPS/FLV. Replace the placeholder destination with the server URL and stream key shown in YouTube Studio, and choose encoder settings that match YouTube’s current recommendations for your output.
ffmpeg -re -stream_loop -1 -i input.mp4
-c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k
-g 60 -keyint_min 60 -c:a aac -b:a 128k -ar 44100
-f flv 'rtmps://SERVER-URL/STREAM-KEY'
This illustrative command has not been tested against your file or a live event. Its video bitrate and GOP values are examples, not universal settings. Set resolution, frame rate, codec, bitrate, and keyframe interval to suit your source and the ingest settings YouTube presents. The command assumes the input has both video and audio. If it does not, adjust the output mapping and audio or video encoding options accordingly.
What the loop and pacing options do
-stream_loop -1tells FFmpeg to repeat the input indefinitely. It is an input option, so put it before the-ifor the file you want to loop. See the FFmpeg command-line documentation.-rereads the file at its native frame rate (equivalent to-readrate 1). FFmpeg documents it as useful when output packet timing matters, including live streaming. Place it before the file input as shown; it does not itself make an output YouTube-compatible. See the FFmpeg command-line documentation.-i input.mp4names the input file. Replace it with the actual path to your file. Quote paths containing spaces according to your shell’s rules.-c:v libx264selects the x264 H.264 encoder;-preset veryfasttrades some compression efficiency for lower encoding demand. Your FFmpeg build must include that encoder.-b:v,-maxrate, and-bufsizegovern the video rate-control target and buffering. The example values should not be treated as YouTube’s recommendation for every resolution or frame rate.-gand-keyint_minset GOP/keyframe spacing in frames. Their time interval depends on frame rate: at 30 fps, 60 frames is about two seconds. Configure this alongside the selected frame rate and YouTube’s keyframe guidance.-c:a aac -b:a 128k -ar 44100encodes audio as AAC at the example bitrate and sample rate. Change or omit audio options if the file has no audio or your chosen output requires a different configuration.-f flvspecifies the output container commonly used with RTMP/RTMPS ingest. The destination combines YouTube’s server URL and stream key; keep the key private.
Prepare the input and choose a stream method
Check the file and FFmpeg build
Before going live, confirm that FFmpeg can open the file and identify its streams. For example, run ffmpeg -i input.mp4 and inspect the reported video and audio streams; FFmpeg may exit after printing file information because no output was requested. Check your build’s available encoders if you intend to use libx264. A command that requests an unavailable encoder will fail before it can send a usable stream.
#1 Best Overall
- 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.
Transcoding versus stream copy
| Method | What it does | Trade-off and checks |
|---|---|---|
| Transcode | Decodes the input and encodes new output, as in the example. | Lets you set output codec and rate, but uses CPU or hardware-encoder resources. Select bitrate for the chosen resolution and frame rate using YouTube’s current table. |
Stream copy (-c copy) |
Passes encoded input streams through without re-encoding. | Can reduce encoding load, but only works if the input codecs, timestamps, container handling, and output are compatible with the ingest requirements. The official guidance cited here does not certify every file for stream copy; verify the result rather than assuming it will work. |
For either method, confirm that the outgoing streams match the YouTube event’s selected settings. If you use stream copy, do not also specify video or audio encoders for streams you are copying.
Set up the YouTube Live event and protect its key
- In YouTube Studio, open the Live Control Room and create or select the stream/event you intend to use. For a scheduled broadcast, make sure you have selected the correct scheduled stream.
- In the stream settings, copy the server URL and stream key provided by YouTube. YouTube describes these as the address and password used by the encoder. Put them into the FFmpeg output destination in place of the example placeholders; never publish a real key in a script, screenshot, chat, or article.
- Use RTMPS for standard encoder ingestion where available. YouTube recommends RTMPS, its secure extension to RTMP. Its current guidance lists H.264, H.265, and AV1 video over RTMP/RTMPS, up to 60 fps, AAC or MP3 audio, CBR, a recommended two-second keyframe interval, and a maximum keyframe interval of four seconds. Bitrate recommendations vary by codec, resolution, and frame rate, so consult YouTube’s current encoder settings, bitrates, and resolutions rather than treating the example bitrate as a general rule.
- Start the FFmpeg command. For a scheduled stream, wait for the encoder preview in Live Control Room, check it, then click Go live when ready. YouTube’s encoder workflow and event setup are described in Create a YouTube live stream with an encoder.
- Monitor stream health during the broadcast. Test before an important event, as YouTube recommends, and verify the result from the Live Control Room rather than assuming that a running FFmpeg process means viewers are receiving a healthy stream.
If the key is exposed, reset it in the Live Control Room and update the encoder destination. Do not leave the credential in a publicly accessible script or log.
Rank #2
- 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.
Choose output settings and confirm your connection
The correct settings depend on the source and event; there is no single bitrate that fits every YouTube Live stream. Use YouTube’s current settings table for the codec, resolution, and frame rate you choose. Keep the frame rate at or below YouTube’s listed 60 fps limit for RTMP/RTMPS, use CBR as recommended, and set keyframes about every two seconds without exceeding a four-second interval. The example’s 60-frame GOP corresponds to two seconds only at 30 fps; at another frame rate, calculate the frame count accordingly.
Your sustained upload capacity must exceed the actual outgoing bitrate, with room for normal network variation and other traffic. If available upload bandwidth is unstable or too close to the stream’s rate, reduce the output resolution, frame rate, or bitrate and recheck YouTube’s recommendations. A valid FFmpeg command cannot compensate for insufficient upload capacity or an unreliable connection.
Recommended Free Tools
Rank #3
- 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.
Copyright, reused content, and the livestream archive
Check rights before looping a file
YouTube scans live streams for third-party content. A match can replace the live image with a placeholder; if the matched content remains, YouTube may interrupt or terminate the stream. If you have a license, the rights holder may still need to add your channel to its Content ID allowlist. Review YouTube’s guidance on copyright issues with live streams and confirm that your permission covers the content and the way you plan to broadcast it.
Copyright permission and monetization eligibility are separate questions. YouTube’s reused-content policy review is distinct from copyright enforcement and is not determined by permission or fair use alone. A license therefore does not guarantee that a repetitive broadcast qualifies for monetization. See YouTube channel monetization policies.
Rank #4
- 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
Do not assume a 24/7 stream will be archived
YouTube’s encoder setup instructions say streams under 12 hours are automatically archived. Do not rely on automatic archiving for a stream lasting 12 hours or longer. If keeping a recording matters, plan a separate local recording or other archive workflow and verify that it is operating; see Manage live stream settings.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common FFmpeg-to-YouTube problems
- FFmpeg reports that the encoder is unavailable: Your build may not include
libx264. Check available encoders, install a build that includes the encoder you need, or select an available compatible encoder and configure it for YouTube’s current ingest guidance. - The file opens but the output fails because a stream is missing: The example assumes both audio and video. Inspect the input streams and adjust mapping and codec options for a video-only or audio-only source.
- YouTube does not show a preview: Check that FFmpeg is still running, the server URL and stream key are the ones for the selected event, and the destination was copied correctly. Verify output codec, container, and settings against the event and YouTube’s recommendations.
- The preview is unstable or YouTube reports poor health: Check available upload capacity against the outgoing bitrate, look for other network traffic, and reduce the output load if needed. Confirm that the selected bitrate is appropriate for the resolution and frame rate.
- The stream starts but the loop does not behave as expected: Confirm that
-stream_loop -1is before the input’s-i. Check FFmpeg output for file-read errors or timestamp/codec issues, particularly if using stream copy. - The image or audio is interrupted by a copyright notice: Review the live-content match and rights status. A license may not prevent an interruption if the rights holder has not allowlisted the channel through Content ID.
- The broadcast ends and no archive appears: Check whether the stream lasted 12 hours or longer; YouTube’s automatic archive statement applies to streams under 12 hours. Maintain an independent recording if an archive is essential.
Or let it run in the cloud
If you want a prerecorded video or playlist to keep a YouTube channel live without leaving your computer on, StreamNeo runs the stream from the cloud. The workflow is: upload a recording or build a playlist, add your YouTube stream key once, then go live. Your computer and home connection do not have to stay on. StreamNeo supports uploaded video as made, up to 4K 60fps, at one price per slot regardless of quality, and automatically recovers if YouTube drops the stream. The first day is free with no card; the monthly option is $9.99 per month. StreamNeo is for YouTube streaming only. See StreamNeo or start the free first day.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Best Value
- 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.
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.




