For a basic 24/7 prerecorded YouTube stream, use FFmpeg’s -stream_loop -1 to repeat a video, then send it to YouTube over RTMPS with a codec-appropriate bitrate, constant bitrate (CBR), a two-second keyframe interval and AAC audio. Looping keeps the file playing; it does not keep FFmpeg, your computer or the network alive. Those need separate monitoring and recovery plans.
The example below is an illustrative starting point for a conventional 1920×1080, 30 fps H.264 file—not a tested command or a guarantee of uninterrupted service. Adjust it to your source and FFmpeg build, and test the full encode and upload path before relying on it.
Choose the bitrate and format for your stream
YouTube’s recommendations depend on the incoming codec, resolution and frame rate. Match your settings to the codec you actually encode; do not use an H.264 bitrate for HEVC or AV1 by assumption. YouTube’s current English-language encoder settings guidance, accessed in 2026, gives these examples:
| Output profile | Minimum video bitrate | Recommended video bitrate |
|---|---|---|
| 720p30, H.264 | 3 Mbps | 8 Mbps |
| 1080p30, H.264 | 5 Mbps | 14 Mbps |
| 1080p30, AV1 or H.265/HEVC | not stated in the cited YouTube table | 10 Mbps |
For a modest 1080p30 H.264 starting point, 5 Mbps is YouTube’s published minimum, not its recommendation. A stronger connection and motion-heavy video may call for the recommended 14 Mbps; only use it if your sustained upload can support it with headroom. YouTube recommends leaving about 20% bandwidth room and testing with audio and motion similar to the intended stream. See YouTube’s encoder settings and bitrate guidance and streaming tips.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →#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.
- Protocol: YouTube supports RTMP/RTMPS and recommends RTMPS, which encrypts the connection to Google’s servers.
- Rate control: Use CBR.
- Keyframes: YouTube recommends a two-second interval and says not to exceed four seconds. At 30 fps, two seconds is 60 frames.
- Audio: AAC or MP3 is supported. YouTube recommends stereo AAC at 128 kbps and 44.1 kHz.
- Video: YouTube lists H.264, H.265/HEVC and AV1, with frame rates up to 60 fps. H.264 is a conservative choice for a broadly compatible FFmpeg setup.
- SDR: YouTube’s guidance specifies Rec. 709 and 8-bit SDR. Its advanced recommendations include progressive scan, two B-frames, one reference frame and CABAC; confirm encoder options against your installed FFmpeg build.
Loop one prerecorded video with FFmpeg
Replace input.mp4 with your file, and replace the ingest URL and key with the values from YouTube Studio. Keep the stream key private: treat it like a password and do not expose it in screenshots, logs, published scripts or source control.
ffmpeg -re -stream_loop -1 -i input.mp4
-c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M
-pix_fmt yuv420p -r 30 -g 60 -keyint_min 60 -sc_threshold 0
-c:a aac -b:a 128k -ar 44100 -ac 2
-f flv "YOUTUBE_RTMPS_INGEST_URL/STREAM_KEY"
This illustrative command assumes an installed FFmpeg build with libx264 and AAC support and a conventional 1920×1080, 30 fps input. The 5 Mbps video bitrate is YouTube’s published H.264 minimum for 1080p30; it is not the recommended bitrate. For the recommended 14 Mbps H.264 value, change both -b:v and -maxrate to 14M, then verify your upload capacity and test stream health.
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.
What the important options do
-stream_loop -1tells FFmpeg to repeat the input indefinitely. It is an input option, so it must appear before the relevant-i.-rereads a file at its native rate to simulate live input. It is useful for prerecorded files, not a universal option for actual live capture.-c:v libx264selects the H.264 encoder. The command uses a constant target/max rate with a buffer as an illustrative FFmpeg configuration; YouTube’s requirement is CBR, and actual rate-control behavior depends on the encoder and build.-r 30sets the output frame rate, and-g 60sets a 60-frame GOP: two seconds at 30 fps.-keyint_min 60and-sc_threshold 0are example x264 choices, not YouTube-mandated flags.-pix_fmt yuv420p,-preset veryfastand-bufsize 10Mare also illustrative choices, not official required values. Check local encoder options and machine capacity.-c:a aac -b:a 128k -ar 44100 -ac 2encodes stereo AAC at 128 kbps and 44.1 kHz. If the source has no audio, test the output and YouTube ingest behavior rather than assuming these audio options create a track.-f flvselects the FLV container used for RTMP publishing. FFmpeg options are positional and apply to the following input or output, so keep option order deliberate.
For other resolutions or frame rates, change the output settings to match the intended profile and consult YouTube’s codec-specific table. More pixels and motion generally demand more bitrate and encoding capacity. The command is not a universal profile for every input.
Set up the YouTube stream key and test before relying on it
- In YouTube Studio, create or open the live stream in Live Control Room and copy the stream URL and stream key provided for the encoder. Follow YouTube’s encoder setup instructions.
- Put the RTMPS ingest URL and key into the command’s output address. Do not share the completed command publicly if it contains the key.
- Check your local FFmpeg version and build configuration, including that the chosen encoder and output protocol are available.
- Run an upload speed test under realistic conditions. Leave bandwidth headroom; YouTube advises that the primary and backup stream bitrates plus about 20% should fit available outbound bandwidth when both are relevant.
- Start the encoder in advance. Check the Live Control Room preview and stream health, then test playback on the watch page and a mobile device. Use audio and motion representative of the actual stream.
- If you have a backup encoder, test failover by stopping the primary or disconnecting its Ethernet, then verify that playback rolls over as intended.
YouTube recommends advance setup and continuous monitoring for encoder-based live streams. A connectivity disruption can break the stream; see YouTube’s streaming tips.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesRank #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.
Separate looping from recovery and failover
“24/7” involves distinct failure modes. Repeating a file does not reconnect a dropped publishing session, restart a failed FFmpeg process or keep a powered-off host and broken internet connection available.
Recovering from temporary output errors
FFmpeg documents a FIFO muxer example using -f fifo -fifo_format flv, -attempt_recovery 1 and -recovery_wait_time 1. That example attempts recovery every second indefinitely. It is an FFmpeg example, not a promise that YouTube will preserve the same player session or that every failure is recoverable. Check behavior against your local version/build and test it with the actual ingest endpoint. See the FFmpeg full documentation.
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
Input-protocol reconnect options are not a general RTMP output-reconnect switch. In particular, do not copy HTTP input options such as -reconnect onto a YouTube RTMP output and expect them to restore publishing; consult the FFmpeg protocol documentation.
Keeping the job and connection available
If the stream must run unattended, use a process supervisor and alerts so a stopped encoder is visible and can be restarted under a deliberate policy. Plan a tested fallback encoder or other recovery path where continuity matters. A reconnect can still leave a gap, and neither an automatic retry nor file looping replaces monitoring.
Free tools Windows power users keep installed
One-click scans. No signup required.
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.
Playlists, long runs and YouTube policy
Multiple files need their own transition testing
A single-file loop is not a playlist system. Files in a concat or playlist workflow need compatible stream parameters and careful handling of timestamps, audio continuity and encoder restarts. Test transitions with the actual files; no single command can be assumed to make arbitrary mixed-file playlists gapless.
Archives and rights are separate from stream configuration
YouTube’s encoder setup guidance says streams under 12 hours are automatically archived. Do not rely on that statement to promise one complete archive for a continuous stream longer than 12 hours; use a separate recording/archive workflow if a durable full-length copy matters. The same guidance says monetization applies if the creator is in the YouTube Partner Program. A 24/7 setup grants no content rights and does not guarantee monetization: check that you have rights to every looped recording and comply with YouTube policies. See YouTube’s encoder setup guidance.
Troubleshooting common failures
- The file plays once and stops: Confirm
-stream_loop -1is before the relevant-iand that the process is still running. - YouTube does not receive the stream: Verify the stream URL, key and RTMPS output address copied from Live Control Room; check FFmpeg build support and the local error output. Never paste a private key into a public support post.
- Stream health reports network trouble or playback breaks: Check sustained outbound bandwidth, competing traffic and the 20% headroom target; test with the actual bitrate and configure a tested backup or restart path.
- Encoding falls behind or the machine is overloaded: Confirm the requested resolution and frame rate, check encoder availability and local load, and test an appropriate preset or lower output profile. Do not assume the illustrative
veryfastpreset fits every machine. - GOP or bitrate is flagged: Use the bitrate row for the output codec and profile, set CBR, and use a two-second keyframe interval within YouTube’s four-second maximum.
- A playlist has gaps or audio glitches: Test file compatibility, timestamps and audio continuity; a single-input loop command does not address playlist transitions.
- The live stream is not available as one complete archive: YouTube’s cited automatic archive statement covers streams under 12 hours. Keep an independent recording if complete long-run retention is needed.
Or let it run in the cloud
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 it from the cloud, so your computer and home connection do not need to stay on. Each slot streams the uploaded quality up to 4K 60fps at one flat price, with no re-encode or quality tiers, and includes automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly service is $9.99 per month.
See StreamNeo for details, or start the free first day.
Quick Recap
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.




