To loop a pre-recorded video on YouTube Live with FFmpeg, use -stream_loop -1 to repeat the input indefinitely and -re to read it at real-time speed, then send the encoded output to the stream URL and key from YouTube Live Control Room. The command below is a 1080p30 H.264/AAC starting point; check the preview and stream health before making the broadcast public.
Before you start
- Install an FFmpeg build that includes the
libx264encoder used in the example. - Have the video file available on the computer that will run FFmpeg, and check that its audio and picture play correctly.
- Make sure your YouTube channel is verified and has no live-streaming restrictions from the previous 90 days. YouTube’s stated minimum age for live streaming is 16. See YouTube’s live-streaming eligibility requirements.
- Allow upload capacity beyond the stream’s total bitrate. YouTube’s streaming tips recommend approximately 20% headroom. See YouTube’s streaming tips.
Get the YouTube stream URL and key
- Open YouTube Studio and create or select a stream in Live Control Room.
- Copy the stream URL and stream key shown for that stream. Replace the destination in the command below with the URL and key in the format YouTube provides.
- Keep the key private. YouTube describes stream keys as password-like credentials that let an encoder send a feed to your stream. Do not post it in a public command, screenshot, or chat. Follow YouTube’s encoder setup instructions for the current Live Control Room workflow.
Run FFmpeg with an infinitely looping input
Replace /path/to/video.mp4 with your file path and replace the example output address with the stream URL and key from Live Control Room:
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 is also an input option; it reads the file at its native frame rate, which is useful when output packet speed matters for live streaming. Both options appear before -i because FFmpeg options generally apply to the next input or output file. See the FFmpeg documentation.
What the encoding settings mean
- Video codec:
libx264encodes H.264 video, a format supported by YouTube’s encoder recommendations. - Bitrate:
-b:v 14Msets video bitrate to 14 Mbps. YouTube lists 14 Mbps as its recommended H.264 bitrate for 1080p30 and 5 Mbps as the minimum for that format. These are platform recommendations, not guarantees that a particular connection or file will work. - Rate control: Matching
-minrateand-maxrateto-b:vmakes this an approximate constant-bitrate-style configuration. YouTube recommends CBR. - Keyframes: At 30 frames per second,
-g 60requests a 60-frame GOP, or a two-second keyframe interval. YouTube recommends a two-second keyframe frequency and says not to exceed four seconds. - Audio:
-c:a aac -b:a 128k -ar 44100encodes AAC audio at 128 kbps and a 44.1 kHz sample rate. - Output container:
-f flvpackages the output for RTMP-style ingest. YouTube recommends RTMPS for encrypted transport; use it when your encoder and the provided ingest endpoint support it.
See YouTube’s current encoder settings, bitrates, and resolutions for recommendations by codec, resolution, and frame rate. The example is intended for 1080p30 output. If the file’s frame rate, audio, or FFmpeg build calls for different settings, adjust the output while keeping YouTube’s ingest recommendations in view. A lower resolution and bitrate may be a better fit when upload capacity is limited.
#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.
Start, preview, and end the broadcast
- Run the command in a terminal on the computer containing the video. Keep that computer and its network connection running for as long as FFmpeg is streaming.
- Wait for the incoming feed to appear in Live Control Room. Confirm that the picture moves and the audio is present.
- Test privately or as an unlisted stream first. Check stream health and monitor the output during the broadcast; a successful FFmpeg connection does not itself make the stream public.
- For a scheduled stream, use the Live Control Room’s Go live control when the preview is ready. Use the current encoder workflow for the selected stream’s start and stop behavior.
- To finish, stop FFmpeg and end the stream in Live Control Room as appropriate for that stream’s settings.
Common problems and fixes
- The video does not repeat: Check that
-stream_loop -1is before-iand applies to the video input. FFmpeg documents-1as infinite looping. - The stream plays too quickly or is not paced for live output: Put
-rebefore-iso FFmpeg reads the file at its native frame rate. - YouTube does not receive a feed: Recheck the stream URL and key copied from the selected Live Control Room stream. A wrong or mismatched key can prevent the encoder from connecting; keep the key private.
- Live Control Room shows poor stream health or buffering: Check available upload capacity against the total stream bitrate, leaving about 20% headroom as YouTube recommends. Reduce resolution or bitrate if the connection cannot sustain the current output.
- The keyframe interval is wrong for the output frame rate: The example’s
-g 60is two seconds only at 30 fps. Set the GOP length to match the intended frame rate and YouTube’s two-second recommendation, without exceeding four seconds. - Video appears but audio is missing or distorted: Confirm the source file contains usable audio and that FFmpeg can decode it. The example’s AAC settings are a starting point; unusual source audio may require adjustment.
- The command connects but the stream is not public: Check the preview and the stream’s state in Live Control Room. Start or end the scheduled broadcast there as required; FFmpeg sending a feed alone does not complete YouTube’s go-live step.
Copyright and channel-policy checks
Only stream video and audio you have the rights to use. Repeating a recording does not grant permission to use its music, gameplay footage, or other material, and a live feed is still subject to YouTube’s policies. Review the relevant rights and channel requirements before broadcasting, and check the stream preview before making it public.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or let it run in the cloud
With the FFmpeg method, the computer running the command and its internet connection must stay on. StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos: upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; each slot streams the uploaded file as made, up to 4K 60fps, at one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. Start your free day on StreamNeo.
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.
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
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.
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.
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.




