FFmpeg’s reconnect options can retry an interrupted HTTP input, but they do not by themselves guarantee that a YouTube stream published over RTMP will reconnect. First identify which side failed: the media source or the connection sending video to YouTube. The options below apply to HTTP inputs; output recovery is a separate problem.
What FFmpeg reconnect options actually cover
FFmpeg’s HTTP protocol options control how it reads an HTTP input. They can retry some disconnections and, with the right settings, treat end-of-file as a reason to reconnect. They do not make a finite local file loop forever, and they do not promise to restore a dropped RTMP publishing connection to YouTube.
The FFmpeg Project defines reconnect as “Reconnect automatically when disconnected before EOF is hit.” It defines reconnect_at_eof as treating EOF like an error that causes reconnection, useful for live or endless streams, and reconnect_streamed as enabling retries for streamed or non-seekable inputs. These are protocol behaviors, not guarantees that a complete YouTube broadcast will remain uninterrupted.
Configure reconnect options for an HTTP live input
For an HTTP live source, this documentation-based pattern enables retries on disconnection, streamed-input errors, and EOF:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
ffmpeg -reconnect 1 -reconnect_streamed 1 -reconnect_at_eof 1
-reconnect_delay_max 10
-i 'https://example.invalid/live.m3u8'
-c copy -f flv 'rtmp://a.rtmp.youtube.com/live2/REDACTED_STREAM_KEY'
The source URL and publishing address above are placeholders. Never put a real YouTube stream key in a published command, screenshot, or log. This is an illustrative starting point, not a universal tested command: the source protocol, installed FFmpeg build, codecs, output container, and YouTube setup all matter.
- Put input options before the input. The HTTP reconnect switches belong before
-ifor the input they configure. They do not configure a later publishing output. - Confirm the source is HTTP. These HTTP options are not a generic reconnect mechanism for a camera, local file, RTSP feed, or another protocol.
- Choose bounded retry behavior. Set finite limits appropriate to the source service. A maximum delay limits how long a retry wait can grow; it is not a promise to retry forever or to restore service within a fixed time.
- Check the installed build. FFmpeg is continuously developed, so verify available options in your local version’s protocol help and inspect any error output rather than assuming every build supports the same switches.
Choose retry controls for the source service
| Option | Effect | When to consider it |
|---|---|---|
reconnect |
Retries after a disconnection before EOF. | When an HTTP source may disconnect temporarily. |
reconnect_at_eof |
Treats EOF as an error and triggers reconnection. | For a live or endless HTTP source where EOF is unexpected or should lead to another connection. |
reconnect_streamed |
Enables retry behavior for streamed or non-seekable HTTP inputs. | When the source is delivered as a stream rather than a seekable resource. |
reconnect_on_network_error |
Retries on TCP/TLS errors during connection. | When connection-level network errors are among the expected temporary failures. |
reconnect_on_http_error |
Accepts a comma-separated list of HTTP status codes or groups such as 4xx and 5xx for retry handling. |
Only when the source’s documented behavior makes those responses plausibly temporary. Retrying broad groups can waste time on permanent errors. |
reconnect_delay_max |
Sets the maximum delay, in seconds, before giving up reconnecting. | To bound the delay between retries. |
reconnect_max_retries |
Sets a maximum retry count; the current FFmpeg reference leaves the default unset. | When you need a finite retry count. |
reconnect_delay_total_max |
Sets a maximum total reconnect delay. | When there is an overall time budget for retries. |
respect_retry_after |
When enabled, honors a server’s Retry-After request instead of using exponential backoff. |
When the HTTP server supplies that header and its timing should be followed. |
Start with only the controls that match the failure you expect. Add network-error or HTTP-status retries deliberately: a retry policy cannot fix invalid credentials, a wrong source address, or a server that is permanently unavailable. Consult the FFmpeg HTTP protocol documentation for the option definitions and confirm syntax against the installed build.
Rank #2
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (4GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- CanaKit Mega Heat Sink - Black Anodized
If the YouTube publishing connection is what drops
If FFmpeg continues reading its source but loses the RTMP connection that sends video to YouTube, HTTP input reconnect options do not address that failure. YouTube’s LiveStreams documentation describes ingestion addresses and supported protocol context; verify the configured destination and stream setup there. Retries cannot repair an invalid address, expired key, or incorrect setup.
FFmpeg documents output handling separately, including recovery-related controls in its FIFO muxer documentation. That is a distinct mechanism to investigate for temporary output failures, not a guarantee that YouTube will resume the same live session or continue at the exact interrupted point.
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 problemsRank #3
- CanaKit Raspberry Pi 5 Essentials Starter Kit
| Where failure occurs | Relevant documented mechanism | What it does not establish |
|---|---|---|
| HTTP source disconnect or EOF | HTTP protocol reconnect options | Recovery for non-HTTP sources or the RTMP publishing output. |
| FFmpeg output write or publishing interruption | Separate output/FIFO muxer recovery controls | Universal recovery of a YouTube live session. |
| Destination or stream setup mismatch | Check the YouTube ingestion configuration and address | That retries can fix a wrong address, expired key, or invalid setup. |
Looping a file is different from reconnecting a source
reconnect retries a network input after a disconnection before EOF; it does not make a finite recording repeat indefinitely. reconnect_at_eof asks FFmpeg to treat EOF as an error and reconnect, which is intended for cases such as live or endless streams. Do not assume that reconnecting resumes a recording at the exact frame where playback stopped: the documented options do not establish that behavior. If your actual goal is to repeat a file, use a looping approach suited to that media workflow rather than treating HTTP retry switches as a file-loop setting.
Troubleshoot reconnects that do not work
- No retry after a source drop: confirm the input is HTTP, the options appear before its
-i, and the local build recognizes them. A switch for HTTP cannot reconnect an RTSP feed or a local file. - FFmpeg reaches EOF and stops:
reconnectalone covers disconnection before EOF. For an HTTP live or endless source where EOF should trigger a new connection, check whetherreconnect_at_eofis supported and enabled. - Retries continue without recovering: the upstream may still be unavailable, the retry bound may be exhausted, or the error may be permanent. Check the source’s status and authentication, and avoid retrying broad HTTP status groups without a reason.
- The source recovers but YouTube stays offline: diagnose the publishing output separately. Check the YouTube ingestion address, stream key, and setup; HTTP input retries do not promise RTMP output recovery.
- The stream does not restart at the expected frame: the cited reconnect behavior does not promise frame-accurate resumption. Treat source reconnection and exact playback continuity as separate requirements.
Or let it run in the cloud
If your goal is to keep uploaded video playing on YouTube without leaving a computer running, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. It runs without a computer or home connection staying on, supports any uploaded quality up to 4K 60fps at one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card required. Monthly billing is $9.99 per month.
Quick Recap
Best Value
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 32GB EVO+ Micro SD Card pre-loaded with 64-bit Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit 45W PD Power Supply for the Raspberry Pi 5
- Display Cable - 6 foot (Supports up to 4K 60p)
Rank #4
- Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Start the free day at StreamNeo registration.
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.

