FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Document ffmpeg reconnect options as opt-in for unstable HTTP sources by luuvasara · Pull Request #661 · Threadfin/Threadfin · GitHub

Repository navigation

Document ffmpeg reconnect options as opt-in for unstable HTTP sources - #661

Open
luuvasara wants to merge 1 commit into
Threadfin:mainfrom
luuvasara:feat/default-reconnect-flags
Open

luuvasara wants to merge 1 commit into
Threadfin:mainfrom
luuvasara:feat/default-reconnect-flags

Conversation

luuvasara commented Jul 10, 2026 •
edited
Loading

Copy link
Copy Markdown

Title: Document ffmpeg reconnect options as opt-in for unstable HTTP sources

Problem

Many IPTV providers periodically tear down long-lived HTTP stream connections (session rotation, load-balancer timeouts, CDN failover). With the current default ffmpeg options there is no in-process reconnect: when the provider closes the connection, ffmpeg exits, the whole buffer pipeline restarts, and client-side segmenters (Plex/Jellyfin live TV) render the discontinuity as a freeze or a short cut every time it happens.

ffmpeg's HTTP reconnect options address that class of drop:

-reconnect 1 -reconnect_streamed 1 -reconnect_on_network_error 1 -reconnect_on_http_error 4xx,5xx -reconnect_delay_max 2

With these, ffmpeg re-establishes the connection inside the same process, so the output timeline stays continuous instead of the buffer layer restarting the stream.

Field caveat (why this is opt-in, not a default)

Testing against a real provider surfaced a worse failure mode on some servers: on every new connection the server replays the last ~30 seconds of content as a catch-up backlog. With in-process reconnect, that replay gets spliced into the same continuous output timeline — the client visibly loops or jumps back over content it already played, on every reconnect.

Without the reconnect flags, a dropped connection makes ffmpeg exit and the buffer layer restarts the stream: a brief cut, but a clean timeline. On servers with backlog-replay behavior, that's the smaller failure of the two.

Since the right choice depends on how a given upstream server behaves after a dropped connection, and there's no reliable way to detect that ahead of time, this should not be an unconditional default for every install.

Change (revised from the original proposal)

The original version of this PR added the reconnect flags directly to System.FFmpeg.DefaultOptions. This revision does not change the default — System.FFmpeg.DefaultOptions is left exactly as it ships today. Instead, src/config.go gets a comment next to the default documenting the reconnect flags, when to add them, and the backlog-replay caveat above, so operators can opt in deliberately after confirming their source doesn't replay backlog on reconnect (Settings > FFmpeg options).

Effect on existing/new installs

None — this is a documentation-only change (a code comment). No behavior changes for any install, new or existing.

Related: #659 touches the same default string; unaffected by this change since the default itself is untouched here.

Many IPTV providers periodically tear down long-lived HTTP stream
connections. Without in-process reconnect, ffmpeg exits and the whole
buffer pipeline restarts, which shows up client-side as a freeze or a
short loop.

ffmpeg's -reconnect family of options fixes that class of drop by
reconnecting inside the same process/output timeline. But field testing
against a real provider surfaced a worse failure mode on some servers:
on every new connection the server replays the last ~30 seconds of
content as a catch-up backlog. With in-process reconnect that replay is
spliced into the same continuous timeline, so the client visibly loops
or jumps back over content it already played. Without the flags, the
process exit + buffer-layer restart produces a clean (if slightly more
abrupt) timeline instead - a smaller failure than the splice-loop.

Since the right answer depends on how a given server behaves after a
dropped connection, and there's no reliable way to detect that up
front, this should not be an unconditional default. This commit
documents the option as a comment next to System.FFmpeg.DefaultOptions
instead of adding it to the default string, so operators can opt in
after confirming their source doesn't replay backlog on reconnect.

No functional change to the default; System.FFmpeg.DefaultOptions is
unchanged from what ships today.
luuvasara force-pushed the feat/default-reconnect-flags branch from b9abbfa to 816f7a8 Compare July 11, 2026 01:50
luuvasara changed the title Add ffmpeg HTTP reconnect flags to the default buffer options Document ffmpeg reconnect options as opt-in for unstable HTTP sources Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL