Free tools Windows power users keep installed
One-click scans. No signup required.
-stream_loop -1 repeats an input when it reaches the end; it does not restart FFmpeg after a local-file error. If FFmpeg exits because a file cannot be opened, demuxed, or decoded, recovery requires an external supervisor or wrapper that records the failure, waits, checks the media, and relaunches FFmpeg or selects a known-good fallback. A restart alone cannot fix a file that remains unreadable.
What kind of failure are you trying to recover from?
“The stream stopped” can describe several different events, and each needs a different response. Start with FFmpeg’s final log lines and exit status rather than treating every interruption as a loop problem.
- Normal end of file: The input was readable and reached EOF. Use
-stream_loop -1before the input’s-ioption to loop it indefinitely. - Corrupt packets, but FFmpeg continues: For supported formats,
-fflags +discardcorrupttells FFmpeg to discard corrupted packets. It does not repair the file or guarantee that decoding can continue. - Local file cannot be opened, demuxed, or decoded: If FFmpeg exits, use an external supervisor or wrapper. Validate the file and choose a fallback or stop and alert if it is still bad.
- HTTP source disconnects: FFmpeg has HTTP-specific reconnect options for certain network and HTTP-status events. These are for HTTP inputs, not local files.
- Publishing to YouTube fails: Treat this as an output or network problem. HTTP input reconnect options do not guarantee recovery of an RTMP/RTMPS YouTube output.
FFmpeg’s command-line documentation defines -stream_loop -1 as an infinite input loop. Its component and protocol documentation describes corrupt-packet handling and HTTP reconnect options in their narrower scopes.
Loop a readable local file at EOF
For one local input, put the input-scoped loop option before -i:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems#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.
ffmpeg -nostdin -stream_loop -1 -re -i input.mp4
-c:v libx264 -c:a aac -f flv "$YOUTUBE_RTMP_URL"
This is an illustrative command shape, not a tested, universal YouTube preset. Supply the current YouTube server URL and stream key securely, and check YouTube’s current encoder requirements for the selected resolution, frame rate, codec, bitrate, and keyframe interval. The example’s -stream_loop -1 handles EOF for a readable input; it does not relaunch FFmpeg after an error.
Option placement matters: FFmpeg options generally apply to the next input or output, and -stream_loop applies to the input that follows it. FFmpeg’s FAQ recommends -nostdin for background invocations, or redirecting standard input, to avoid terminal input interfering with an unattended job. It does not add restart behavior.
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.
Handle damaged packets without mistaking it for file recovery
You can try -fflags +discardcorrupt as an input flag when the problem is corrupted packets in a supported input. It asks FFmpeg to discard those packets. Depending on the damage, playback may continue with missing or impaired media, or FFmpeg may still fail.
Discarding packets does not repair a container, make an unopenable file readable, or supervise a process after it exits. If the error is persistent, the robust response is to validate the input and move to a known-good fallback, or stop and alert someone rather than relaunching the same failing file indefinitely.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →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.
Restart FFmpeg after a local-file failure
FFmpeg options such as -xerror and -max_error_rate do not launch another FFmpeg process. The first stops and exits on an error; the second controls an exit-code threshold for decoding failures, and crossing it does not terminate processing. Use a service manager or wrapper to own the restart policy.
- Capture the evidence: Save FFmpeg’s stderr and exit status for each run. Use the final log lines to distinguish a local input failure from an output write or connection failure.
- Wait before retrying: Apply a bounded delay so a persistent fault does not create a rapid restart loop.
- Check the media: Confirm that the intended file exists and is readable, and run an appropriate validation or probe step for your environment.
- Choose a recovery action: Relaunch with the original file only if it is usable; otherwise switch to a known-good alternate, alert an operator, or stop cleanly.
- Keep a retry limit or alert condition: Repeated failures should trigger a controlled stop or notification rather than an endless cycle.
The exact service-manager configuration depends on your operating system and supervisor. No single restart command fits every setup, and a supervisor can restart a process but cannot make permanently damaged media valid.
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
Which recovery mechanism fits?
| Situation | Suitable mechanism | What it does not establish |
|---|---|---|
| Readable file reaches EOF | -stream_loop -1 before -i |
Recovery from an unreadable file or a process that has exited |
| Some damaged packets in a supported input | -fflags +discardcorrupt |
Repair of the file or guaranteed continued decoding |
| FFmpeg exits after a local-file failure | External supervisor plus validation and fallback | Automatic recovery by FFmpeg alone |
| HTTP input disconnects or gets configured retryable errors | Applicable HTTP protocol reconnect options | Local-file recovery or RTMP output recovery |
| YouTube output is unstable | Check output settings, upload capacity, stream health, and failover | Correction of a broken local input |
Keep YouTube ingest and local-file health separate
A readable, looping input does not ensure YouTube is receiving a healthy stream. YouTube’s encoder settings guidance lists RTMP/RTMPS ingestion and CBR, and recommends a 2-second keyframe interval that does not exceed 4 seconds. Use the current page’s settings for your resolution, frame rate, and codec rather than copying a bitrate without its context.
YouTube also recommends testing the encoder before going live and monitoring stream health. Its streaming tips recommend about 20% upload bandwidth headroom and testing encoder failover. These checks address delivery and ingest; they cannot establish that a local file is readable.
Recommended Free Tools
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.
Protect the stream key as a password. YouTube explains that it tells the encoder where to send the feed and lets YouTube accept it in its stream settings guidance. If the output fails, inspect the publishing connection and YouTube stream health separately from the input’s file and decoder logs.
Troubleshoot common loop and restart failures
- The file plays once and then stops: Check that
-stream_loop -1appears before that file’s-i. It is an input option and must apply to the intended input. - FFmpeg exits despite the loop option: The loop covers EOF, not every open, demux, or decode error. Use the exit status and stderr to identify the failure, then supervise the process and validate or replace the input.
- Discard-corrupt does not help: The flag only discards corrupted packets where supported. It does not repair a damaged container or recover a file that cannot be opened.
- The job keeps restarting and failing: The input may still be invalid. Add a bounded delay, retry limit or alert, and a known-good fallback instead of restarting rapidly with the same file.
- HTTP reconnect flags do not restore the YouTube stream: Those flags apply to HTTP protocol events. They do not repair local decoding or guarantee an RTMP/RTMPS output resumes.
- The input loops but YouTube reports a problem: Review encoder settings, stream health, outbound upload capacity, and failover independently. A healthy output path does not prove that the media is intact, and vice versa.
- An unattended process suspends or waits for input: Use
-nostdinor redirect standard input as described in the FFmpeg FAQ. This prevents a terminal-input issue; it is not a restart policy.
Or let it run in the cloud
If maintaining an FFmpeg process and restart supervisor is more work than you want, StreamNeo keeps a YouTube channel live from uploaded videos: upload a recording or build a playlist, add the YouTube stream key, and go live. Nothing has to stay on at home; it loops from the cloud. Every slot streams the upload as made, up to 4K 60fps, at one price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly is $9.99 per month.
Start your free first day with StreamNeo.
Sources and version scope
FFmpeg’s online command-line and component pages are regenerated nightly and correspond to the newest revision; compare options with the FFmpeg build installed on your system. YouTube’s encoder and streaming guidance linked above was accessed on October 3, 2026, and its platform recommendations may change. The restart architecture here is an operational approach based on the documented scope of the FFmpeg options, not a tested universal wrapper or a guarantee that a failing file can be recovered.
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.




