unarr/internal
Deivid Soto 66ac79664b feat(stream): real-time transcoding for non-browser-decodable codecs
Source files in HEVC, AV1, AC3, DTS, EAC3, etc. now transcode through ffmpeg
to fragmented MP4 (h264 + aac) on-the-fly when the browser would otherwise
play silent black. Decision matrix lives in engine.DecideAction:
passthrough → remux → audio-transcode → full video-transcode.

Architecture — temp file + growing-size source:
- engine.streamSource interface abstracts byte source. Two impls:
  * diskFileSource: passthrough when codecs are already browser-friendly.
  * transcodeSource: spawns ffmpeg writing to a /tmp/tc-stream-*.mp4 file.
    A ticker polls file size and wakes blocked ReadAt callers as ffmpeg
    produces output. Estimate of final size (bitrate × duration) is
    announced over the wire so the browser's scrubber has something to
    anchor on.
- dataChannelPump now reads from streamSource instead of *os.File. HELLO
  carries Transcoding=true + an estimated total size; Seekable=true (we
  read random-access from the temp file even while writing).
- Transcoder runtime resolved per session by buildTranscodeRuntime in
  cmd/daemon: ffmpeg/ffprobe path lookup + HWAccel auto-detection
  (NVENC/QSV/VAAPI/VideoToolbox).
- New [downloads.transcode] TOML section: enabled (default true), hw_accel
  (auto), preset (veryfast), video_bitrate (5M), audio_bitrate (192k),
  max_height (optional downscale), max_concurrent (safety cap).

Falls back to passthrough if ffprobe is missing, fails, or codecs are
already browser-friendly. tmp file is cleaned up on session shutdown.
2026-05-07 09:26:05 +02:00
..
agent feat(stream): pion-based WebRTC byte streamer for browser playback 2026-05-06 23:12:38 +02:00
arr feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
cmd feat(stream): real-time transcoding for non-browser-decodable codecs 2026-05-07 09:26:05 +02:00
config feat(stream): real-time transcoding for non-browser-decodable codecs 2026-05-07 09:26:05 +02:00
engine feat(stream): real-time transcoding for non-browser-decodable codecs 2026-05-07 09:26:05 +02:00
library feat(mediainfo): ResolveFFmpeg + DownloadFFmpeg mirroring ffprobe pattern 2026-05-06 09:49:32 +02:00
mediaserver feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
parser feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
sentry feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
streaming test(streaming): integration tests with real ffmpeg (skipped without it) 2026-05-06 11:35:52 +02:00
ui fix(ci): fix lint errors and pin CI to Go 1.25 2026-03-31 22:15:12 +02:00
upgrade fix(upgrade): retry download on transient network errors with user feedback 2026-04-09 14:15:32 +02:00
usenet fix(ci): fix lint errors and pin CI to Go 1.25 2026-03-31 22:15:12 +02:00