To loop a video into YouTube Live with FFmpeg, use -stream_loop -1 before the input file’s -i, then encode and send the output to YouTube using settings matched to the chosen resolution, frame rate, and codec. Looping repeats the file; encoding sets the outgoing stream format. Neither alone guarantees an uninterrupted broadcast: the source file, upload connection, computer, stream key, and YouTube’s stream health all matter.
What “the right format” means for a live stream
A prerecorded file does not have to be converted just because it is being streamed. First check whether its video, audio, resolution, frame rate, and aspect ratio suit the live output you want. If they do, FFmpeg may be able to send the source without changing its codecs; if not, re-encode or apply filters to produce a compatible output.
There are two separate jobs in a looping command:
- Input looping:
-stream_loop -1tells FFmpeg to repeat the input indefinitely. It is an input option, so put it before that input’s-i. - Output encoding and delivery: encoder, bitrate, keyframe timing, audio, and output destination determine what FFmpeg sends to YouTube Live.
FFmpeg’s documentation describes -stream_loop in its command-line documentation. The example below is an illustrative starting pattern, not a tested, universal command.
Choose YouTube settings that fit your video and connection
YouTube’s live encoder guidance lists H.264, H.265/HEVC, and AV1 for video, and AAC or MP3 for audio. Its bitrate recommendations vary by codec, resolution, and frame rate. The following values are YouTube Help’s published H.264 figures in the English-language guidance; check the current table and the row for your selected codec before streaming.
#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.
| H.264 ingestion resolution and frame rate | Minimum video bitrate | Recommended video bitrate |
|---|---|---|
| 1080p at 60 fps | 6 Mbps | 17 Mbps |
| 1080p at 30 fps | 5 Mbps | 14 Mbps |
| 720p at 60 fps | 3 Mbps | 8 Mbps |
| 720p at 30 fps | 3 Mbps | 8 Mbps |
For comparison, YouTube’s table recommends 10 Mbps for AV1 or H.265 at 1080p30 and 12 Mbps at 1080p60, with a 4 Mbps minimum for both examples. These figures are codec-specific; do not apply the H.264 rows to AV1 or H.265. Consult YouTube’s current live encoder settings, bitrates, and resolutions for the full table.
Resolution and frame rate
Choose a target that suits the source and the motion in the video. Avoid upscaling low-resolution footage simply to select a higher stream setting. If you change resolution or frame rate, make the output match your selected YouTube table row and test that the file plays correctly through the loop.
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.
Bitrate and upload headroom
YouTube says the total bitrate must fit the available upload bandwidth and recommends leaving 20% headroom. Include audio in your bandwidth planning and assess the connection over the length of the intended broadcast, not only from a brief speed test. A bitrate near the recommendation is not useful if the connection cannot sustain it reliably.
Keyframes, scan, color, and audio
YouTube recommends a two-second keyframe interval and says it should not exceed four seconds. For conventional SDR H.264, its guidance also lists CBR, progressive scan, square pixel aspect ratio, CABAC, and Rec. 709. It lists 44.1 kHz audio, with 128 Kbps for stereo and 384 Kbps for 5.1 surround. Its page identifies H.265 as the recommended HDR video codec and says AV1 is not supported for HDR. Check the current YouTube guidance for the codec and signal type you intend to send.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #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.
Build an FFmpeg loop-to-YouTube command
This pattern repeats input.mp4, paces reading at the file’s native rate, encodes H.264 and AAC, and sends an FLV-muxed output to an RTMPS destination. Replace the placeholders and settings for your media, FFmpeg build, available upload, and the applicable YouTube bitrate table row.
ffmpeg -stream_loop -1 -re -i input.mp4
-c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k
-g 60 -c:a aac -b:a 128k -f flv
"rtmps://<YouTube-ingest>/<stream-key>"
The sample’s 4500k is only an illustrative value; it is not a YouTube recommendation and does not match every resolution and frame-rate case. Likewise, -g 60 corresponds to a two-second interval only when the output is 30 fps. At another frame rate, adjust the GOP/keyframe timing to preserve the intended interval. The option is a conventional FFmpeg/libx264 example, not a command prescribed by YouTube.
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
- Inspect the source. Confirm the file path, playback, resolution, frame rate, aspect ratio, video codec, and audio track. Decide whether the source can be sent as-is or needs re-encoding or filtering.
- Select the output settings together. Choose a YouTube-supported codec, resolution, frame rate, bitrate, keyframe interval, and audio format. Match the bitrate to the codec-specific table, then make sure the machine can encode it and the connection can upload it with headroom.
- Set the loop and pacing. Keep
-stream_loop -1before-i input.mp4. The example’s-repaces file input like a live source rather than reading it as fast as possible. - Configure the destination. Use an RTMPS YouTube ingest URL where supported by your FFmpeg build and destination. Enter the stream key in the destination string or other appropriate configuration method; treat it as a password and do not share or publish it.
- Test before relying on a long run. Start a private or otherwise appropriate test, check that both audio and representative motion are present, and review YouTube’s stream health and messages. YouTube Help says, “Make sure to test before you start your live stream.” Its encoder settings guidance advises testing audio and movement similar to the planned stream and monitoring health and messages during the event.
YouTube recommends RTMPS. FFmpeg support for particular encoders, muxers, and protocols depends on how the installed build was compiled. Verify that your build supports the options you use, and validate the output in YouTube’s control room. YouTube automatically transcodes live streams into output formats for different viewers; that does not remove the need to send a stable, correctly configured input stream.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Keep a long broadcast stable
A looping command can keep reading a file, but an unattended broadcast also depends on conditions outside that option. Test the actual file, computer, connection, and YouTube destination for the length and settings you intend to use. Avoid assuming that a command that starts successfully will recover from every network, encoder, or platform interruption.
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.
- Media: Test the transition from the file’s end back to its beginning. Inspect for black frames, silence, abrupt audio changes, damaged sections, or content that should not be rebroadcast.
- Encoder capacity: Confirm the computer can encode the chosen resolution and frame rate continuously without falling behind, overheating, or stopping. A preset such as
veryfastis a trade-off, not a guarantee of capacity or quality. - Network: Use a stable upload connection with headroom above the total outgoing bitrate. A short test cannot establish that a connection will remain stable for an extended stream.
- YouTube monitoring: Watch stream health and messages during the broadcast, and check audio and moving video rather than assuming a connected status means the stream looks right. See YouTube’s live stream settings guidance and streaming tips.
- Rights and channel policies: Having a file does not establish the right to rebroadcast it. Confirm you have the necessary rights and review YouTube’s applicable rules, including copyright and reused-content policies, before using a video continuously.
Troubleshoot common failures
| Symptom | Likely cause | What to check or change |
|---|---|---|
| The video plays once and stops | The loop option is missing or placed after the input it should affect. | Put -stream_loop -1 before -i input.mp4 and verify the exact input path. |
| YouTube does not receive the stream | Incorrect ingest URL or key, unavailable RTMPS support, or an FFmpeg build missing needed support. | Recheck the destination and key in YouTube’s control room, keep the key private, and verify the installed build’s protocol and muxer support. |
| Stream health reports problems or video stutters | Upload capacity is insufficient or unstable, or the selected bitrate does not fit the connection. | Check the total outgoing bitrate against sustained upload capacity with YouTube’s recommended 20% headroom; lower the output target if needed and test again. |
| Audio is missing, distorted, or out of sync | The source audio track, chosen audio encoding, or output settings may be unsuitable. | Inspect the source track and test the complete output with representative audio before going live; confirm AAC or MP3 settings are supported by the selected workflow. |
| Video looks soft or has the wrong dimensions | The source and output resolution, frame rate, aspect ratio, or bitrate may not align. | Inspect the source and intended output; choose the appropriate YouTube table row and add scaling or frame-rate filters only when required. |
| The stream ends despite the loop option | The process, computer, connection, or YouTube ingest may have failed; input looping alone does not recover every failure. | Check FFmpeg output, machine availability, network stability, stream key configuration, and YouTube health messages. Test any restart or recovery procedure before depending on it. |
Or let it run in the cloud
If you do not want a local computer and home connection to keep the broadcast running, 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. StreamNeo loops uploaded video from the cloud; it does not stream from a camera.
- Nothing has to stay on at home.
- Any uploaded quality up to 4K 60fps streams as made at one flat price per slot, without re-encoding or quality tiers.
- Automatic recovery is included if YouTube drops the stream.
- The first day is free, with no card required.
Monthly: $9.99 per month. The first day is free once per account; longer or shorter billing periods are also available. UPI and cards are accepted in India, and card checkout is available worldwide. See StreamNeo pricing for details.
Quick Recap
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.




