Skip to content

Fix ffmpeg redirects. Fix max resolution setting. - #124

Open
asandhu3 wants to merge 1 commit into
technomancer702:mainfrom
asandhu3:ffmpeg-fixes
Open

asandhu3 wants to merge 1 commit into
technomancer702:mainfrom
asandhu3:ffmpeg-fixes

Conversation

@asandhu3

Copy link
Copy Markdown

Fixes #123.

Changes

  • FFmpeg/ffprobe input hardening (probe.js, remux.js, transcode.js, transcodeSession.js)

    • -http_persistent 0 — forces a fresh connection per hop so https → http redirects resolve cleanly. Was reading 302 body as stream content.
    • -reconnect_on_http_error 4xx,5xx — handles intermittent 407 Proxy Authentication Required from the CF edge (FFmpeg only special-cases 400/401/403/404 natively).
    • -reconnect_delay_max bumped from 3/5 → 10 to cover CF's rate-limit window.
  • Max Resolution now actually caps (transcodeSession.jsbuildScaleFilter)

    • Previously scaled to the exact target height regardless of source resolution, so Max = 4K upscaled 1080p sources to 4K. Now computes Math.min(targetHeight, sourceHeight) in JS and emits a literal integer
      into the filter (scale_cuda=-2:1080:... instead of scale_cuda=-2:min(2160,ih):...). Testing showed the expression form triggers a degraded scale_cuda code path — literal 1080 ran at 1.8x realtime vs 0.69x
      with the expression, on identical source.
    • videoHeight plumbed through: probe → POST /api/transcode/sessionTranscodeSession.options → scale filter.
    • Graceful fallback when source height is unknown (probe skipped/failed): uses the configured target directly, same behavior as before the cap feature.
  • Negative-cache probe failures (probe.js)

    • Failed probes now populate the cache with a shorter effective TTL (~30 s) so a client retry doesn't immediately re-hit the provider and double the connection count on rate-limited accounts.
  • Frontend: VideoPlayer.js and WatchPage.js pass videoHeight: info.height from the probe result into the transcode session POST body.

ryantaylor16 added a commit to ryantaylor16/nodecast-tv that referenced this pull request Jul 9, 2026
…peg)

PR technomancer702#124 added -http_persistent 0 to the probe/remux/transcode ffmpeg
commands, but the ffmpeg build in the image rejects it with 'Option
http_persistent not found', causing every stream to fail with exit
code 8. Drop the flag from all four command builders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ryantaylor16 added a commit to ryantaylor16/nodecast-tv that referenced this pull request Jul 9, 2026
- reconnect_on_http_error: drop 4xx, keep 5xx. Providers return 458
  (connection-limit) and other 4xx as terminal conditions; retrying them
  (from PR technomancer702#124) made the player spin forever instead of surfacing a
  clear failure. 5xx (transient server errors) still reconnect.
- /channels/recent now excludes 'FOR ADULTS' categories from the home
  dashboard while leaving them browsable in the Movies tab (does not
  match the 'ADULT SWIM' series categories, which stay).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

[BUG] Transcodes fail with ffmpeg exit code 8

1 participant