v2: mpegts.js + single-upstream fan-out hub (no FFmpeg/HLS)

Replaces the FFmpeg -> MediaMTX -> HLS pipeline with a raw MPEG-TS
fan-out architecture:

- Go stream.Hub holds ONE upstream connection per active channel and
  broadcasts the raw TS bytes to all connected browsers via /ts.
  The IPTV provider only ever sees one IP (the server), no matter how
  many viewers are watching (shared single-channel model).
- Frontend uses mpegts.js to play the raw TS in-browser via MSE,
  fixing HEVC/H.265 4K streams that HLS could not package.
- Dropped FFmpeg, MediaMTX, RTMP/RTSP, HLS proxy, playback/ingest
  modes, the OBS source toggle, and FFmpeg health stats.
- UI look preserved (fullscreen video, collapsible sidebar, status
  bar, upstream-down banner, hourly playlist auto-refresh).

Tradeoff: loses iOS Safari (no MSE/mpegts.js); fixes desktop/Android
playback of both H.264 and H.265.
This commit is contained in:
2026-06-12 19:33:06 -07:00
parent 88a189de34
commit 723ae1f1ac
18 changed files with 432 additions and 899 deletions

View File

@@ -12,33 +12,19 @@ RUN bun install && bun run build
# Stage 3: Runtime
FROM alpine:3.20
RUN apk add --no-cache ffmpeg ca-certificates wget tar \
&& wget -qO /tmp/mediamtx.tar.gz \
https://github.com/bluenviron/mediamtx/releases/download/v1.12.2/mediamtx_v1.12.2_linux_amd64.tar.gz \
&& tar -xzf /tmp/mediamtx.tar.gz -C /usr/local/bin mediamtx \
&& rm /tmp/mediamtx.tar.gz \
&& apk del wget tar
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=backend /out/tuner /app/tuner
COPY --from=frontend /src/dist /app/frontend/dist
COPY mediamtx.yml /app/mediamtx.yml
ENV RESTREAMER_PORT=8080
ENV PLAYLIST_PATH=/data/playlist.m3u
ENV PLAYLIST_URL=https://pia.cx/m3u/630xhAmY/smp424GL
ENV PLAYLIST_USE_LOCAL=false
ENV PLAYLIST_AUTO_REFRESH_INTERVAL=1h
# Playback mode: "standard" (MPEG-TS, iOS-friendly), "fmp4" (HEVC/H.265), or "llhls"
ENV PLAYBACK_MODE=standard
# Ingest mode: "rtmp" (default) or "rtsp" (better for HEVC/H.265)
ENV INGEST_MODE=rtmp
# RTSP ingest audio mode: "aac" (transcode audio, recommended) or "copy"
ENV INGEST_AUDIO_MODE=aac
ENV MEDIAMTX_PATH=/usr/local/bin/mediamtx
ENV MEDIAMTX_CONFIG=/app/mediamtx.yml
ENV FRONTEND_DIR=/app/frontend/dist
EXPOSE 1935 8080 8888
EXPOSE 8080
ENTRYPOINT ["/app/tuner"]