truewhile 5f4b613bde 修复 115 云转码播放中途断流后直接掉到本地转码
115 云 HLS 会话只存在服务端内存里:服务重新部署、会话过期(30 分钟无活动)、
上游分片地址失效,都会让播放中的客户端在后续分片上拿到 404/410。原实现此时
直接退回本地转码,而低配宿主机本地转码追不上播放速度(实测 2 vCPU 只有
0.62x),用户看到的就是播放报废。

- 云 HLS 中途 fatal 时先重建会话续播(10 分钟内最多 3 次),仍失败才退回本地
- manifestLoadingMaxRetry 1 -> 4:master.m3u8 每次都要现调 115 接口,一次抖动
  不该直接判死刑
- 播放列表重写改用上游地址哈希做 key:原来用自增序号,每次重写 entries 就膨胀
  一轮、分片编号漂移(实测 762 段列表重写几次后 key 涨到 e2288..e3049)
- 会话条目数加上限,异常播放列表不会无限占用内存
- 客户端断开(seek / 切清晰度取消在途请求)不再记成 502,改记 499 与 nginx
  对齐;会话失效返回带 code 的 404/410,便于前端判断需要重建会话
- 修正进度/时长上报:云 HLS 时间轴起点恒为 0,不应再叠加 hlsStartSec(历史上
  把 7624s 的片子记成 8346s 并标成「已看完」)
- 切回直连 / 原画时保住播放位置:HLS 卸载会把 currentTime 归零,必须在切换前
  先记下目标位置
2026-10-08 22:52:31 +08:00
2026-09-07 23:45:59 +08:00
2026-10-01 22:18:37 +08:00
2026-09-05 14:32:58 +08:00
2026-10-08 11:13:10 +08:00
2026-10-01 21:57:25 +08:00
2026-10-08 20:13:46 +08:00
2026-09-30 19:22:24 +08:00
2026-09-14 15:12:42 +08:00
2026-09-30 19:22:24 +08:00
2026-09-14 15:12:42 +08:00
2026-10-01 22:18:37 +08:00
2026-10-01 22:18:37 +08:00
2026-10-01 22:18:37 +08:00

MeBox

MeBox Logo

A self-hosted media center for NAS and home theater

Libraries · Metadata · Cloud STRM · Emby/Jellyfin client compatible · Remote Emby mounts · Multi-user · Docker-first

中文 · Overview · Quick Start · Deployment · Acknowledgements · Development · Telegram

Go React Docker License


Overview

MeBox is a self-hosted private media management system for NAS, mini PCs, family sharing, and multi-device playback. This repository is a maintained fork of MediaStationGo, extended with stronger cloud playback, task queues, remote mounts, and permission controls.

In practice, MeBox gives you:

  • A modern web media library
  • An Emby/Jellyfin-compatible protocol gateway for third-party players
  • A single panel for local disks, download folders, and cloud storage

Key capabilities

Area Highlights
Libraries Movies, TV, anime, variety, music, custom libraries; multi-root scanning; poster wall; continue watching
Metadata TMDb, Bangumi, Douban, TheTVDB, Fanart, NFO import, manual matching, scrape queue
Playback Web player, HLS transcoding, danmaku, subtitles, play profiles, history and favourites
Emby/Jellyfin client compatible Full Emby server protocol implementation: Infuse, SenPlayer, Fileball, and official Emby/Jellyfin clients can add MeBox as an Emby server and sign in with MeBox accounts — poster walls, watch progress, and multi-user work out of the box
Remote Emby mounts Browse remote Emby libraries inside MeBox without a separate Emby client
Cloud & STRM OpenList, CloudDrive2, 115, WebDAV; STRM sync; upload/download queues; direct or 302 playback
Downloads & organize Scheduled download-folder organization (smart classification, auto library registration), file manager (copy/move/hardlink/symlink)
Users & permissions Admin/regular users, expiry, NSFW toggle, play-profile PIN, granular permissions
Operations Unified task queue, storage stats, DLNA casting, settings and logs

Tech stack

  • Backend: Go, Gin, GORM, SQLite or PostgreSQL, optional Redis and OpenSearch
  • Frontend: React 18, Vite, TypeScript, Tailwind CSS, Zustand
  • Deployment: Standalone Docker Compose templates, amd64/arm64 images, single-binary releases

Quick Start

Docker Compose is the recommended path. The repo ships four standalone templates; no .env is required.

mkdir -p MeBox && cd MeBox

# Simplest: one container with built-in SQLite
curl -fsSL https://raw.githubusercontent.com/truewhile/MeBox/main/docker-compose.simple.yml -o docker-compose.yml

# Or PostgreSQL tier for multi-user setups
# curl -fsSL https://raw.githubusercontent.com/truewhile/MeBox/main/docker-compose.yml -o docker-compose.yml

docker compose up -d

Open:

http://SERVER_IP:18080

Default login: admin / admin123 — change the password immediately.

💡 Seamless for Emby users: MeBox fully implements the Emby/Jellyfin client protocol. Infuse, SenPlayer, Fileball, and official Emby/Jellyfin apps on phones, TVs, and tablets can add it as an Emby server at http://SERVER_IP:18080 and sign in with MeBox accounts — no change to your existing workflow.

Image:

ghcr.io/truewhile/mebox:latest

Deployment tiers

Pick one compose file. Do not stack multiple -f files.

Tier File Stack Best for
Single image docker-compose.simple.yml MeBox + SQLite Beginners, single-user, low-resource NAS
Tier 1 docker-compose.yml MeBox + PostgreSQL Most home NAS deployments
Tier 2 docker-compose.standard.yml + Redis Multi-user, frequent Emby client refreshes
Tier 3 docker-compose.search.yml + OpenSearch Very large libraries, advanced full-text search

Single-image notes

  • Only one MeBox container; database lives in ./data/mebox.db
  • Do not set MEBOX_DATABASE_DSN or it switches to PostgreSQL
  • Back up ./data; ./cache can be rebuilt

PostgreSQL notes

  • Primary DB: ./postgres; secrets and runtime files: ./data
  • Existing ./data/mebox.db migrates automatically on first start
  • After migration, point MEBOX_DATABASE_DB_PATH at a non-existent file to disable re-checks

Backup

Path Notes
./data JWT secret, config, SQLite DB or migration source
./postgres PostgreSQL primary DB
./cache, ./redis, ./opensearch Rebuildable

Update

docker compose pull mebox
docker compose up -d --no-deps mebox

Path mapping

The most common Docker mistake is mixing host paths with container paths.

  • Left side of volumes = real host/NAS path
  • Right side = container path; use /media/... in the web UI
  • Keep MEBOX_MEDIA_DIR / MEBOX_DOWNLOAD_DIR aligned with mounts when organizing or ingesting downloads

Example:

volumes:
  - /vol1/1000/Media:/media
  - /vol1/1000/Downloads:/downloads
environment:
  MEBOX_MEDIA_DIR: /vol1/1000/Media
  MEBOX_MEDIA_CONTAINER_DIR: /media
  MEBOX_DOWNLOAD_DIR: /vol1/1000/Downloads
  MEBOX_DOWNLOAD_CONTAINER_DIR: /downloads

First-time setup

  1. Create a library with a container path such as /media/Movies, then scan
  2. Add metadata providers (TMDb, Bangumi, etc.) in system settings
  3. Optionally set up download-folder auto-organization under file management so finished downloads land in the right library
  4. Optionally configure cloud accounts under STRM management
  5. Add the server in Emby-compatible players at http://SERVER_IP:18080 using MeBox credentials

FAQ

Library scan is slow
Check path mapping and DB tier. Cloud scans also depend on API limits and folder size.

Downloaded files are not organized
Ensure the download directory is mounted into the container and env vars match. MeBox handles folder organization; run qBittorrent or any downloader yourself as a regular app.

Hardlink fails with cross-device link
Hardlinks require the same filesystem/subvolume; use copy or symlink across disks or cloud mounts.

External player cannot connect
Use http://IP:18080 and a MeBox user account; reverse proxies need correct external URL and HTTPS headers.


Development

The backend embeds web/dist via go:embed. Build the frontend first.

npm --prefix web ci
npm --prefix web run build

go test ./...
go run ./cmd/server
npm --prefix web run dev

Release builds ship single-file binaries for Windows, Linux, and macOS on amd64 and arm64.

Build the Windows executable locally:

.\scripts\build-windows.ps1 -Version dev

The Windows executable uses the project logo and runs without a console window. It stays in the notification area, with menu actions for opening MeBox, toggling auto-start, viewing logs, restarting, and exiting.


Acknowledgements

MeBox is forked from and continues to evolve MediaStationGo. Thank you to the upstream project for the media-library architecture, Emby-protocol compatibility, and self-hosted foundation.

Many cloud sync, STRM, and media-organization ideas in this project were also informed by qmediasync. Thank you for the reference implementation and design patterns.


Contributing

See CONTRIBUTING.md and SECURITY.md before opening issues or pull requests.


Star History

Star History Chart

License

This project is licensed under GPL-3.0.


Support & Donate

If MeBox makes your home theater life easier, feel free to buy the maintainer a coffee ☕

WhileTrue donation QR

Telegram group: https://t.me/MeBoxGroup
Questions, feature requests, and release news — come chat with us

S
Description
No description provided
Readme 79 MiB
Languages
Go 73.5%
TypeScript 26.4%