Jellyfin 直連 Alist 阿里雲盤
家裡沒有 NAS,網路環境沒有 IPV6,也沒有公網 IPV4,無法 DDNS 到軟路由,行動大內網使用zerotier或 tailscale 的速度也不穩定(我嘗試過自建 zerotier 的 moon,效果提升也不大),電腦 24 小時內網穿透也不現實,又想要給家人朋友一個良好的觀影體驗(不在同一個社區),就只能在頻寬只有 3M 且效能雞肋的阿里雲伺服器上採取這種方案jellyfin+alist+rclone + medialink
另外最近由於阿里雲盤的限制越來越嚴格,即使你開了三方權益包沒有 SVIP 也會被 QPS 限制,可能是 1 分鐘內 2 到 3 次,刮削資料都會達到風控標準,要想保證觀影體驗就需要盡可能的降低存取雲盤的次數(當然 strm 檔案也可以,個人覺得嘗試後 bug 更多了就沒有使用)
透過前置 emby 或 jellyfin,既能解決沒有魔法裝置的刮削問題,還能讓 infuse 或 kodi 等軟體不再進行刮削,直接從 emby 或 jellyfin 獲取,很大程度上避免了風控,於是採取了這種方案並記錄自己的完整操作和踩坑
不過這種方式 jellyfin 的 web 端和用戶端無法播放影片,透過 infuse 或 kodi 或 senplayer 等新增 jellyfin 可以完美播放
我選擇了jellyfin而不是emby因為阿里雲 ECS 的網路環境導致的,jellyfin可以非常方便的使用豆瓣進行刮削
jellyfin在主機安裝,因為 docker 安裝 jellyfin 會有不同步的 bug,rclone 掛載 alist 到本地 /mnt,/mnt 再映射到 jellyfin 容器中後,alist 影片更新,即使 rclone 手動更新 /mnt 下的掛載檔案,jellyfin 容器中資料也會有無法更新的 bug
rclone
踩坑:記得rclone最好掛載你alist的根目錄
在測試時,一直失敗,發現日誌錯誤如下
存取路徑為
/177/TS/xxx (2024)/Season 1/S01E09 - 2160p.H.265.WEB-DL.AAC.mp4
發生了路徑/TV遺失,正確的應該是
/177/TV/TS/xxx (2024)/Season 1/S01E09 - 2160p.H.265.WEB-DL.AAC.mp4
後來改為根目錄一切正常,當然,也可能當時其他設定配置出錯導致的
先選擇一個想安裝的資料夾 官方教學 Install rclone config docs
安裝
mkdir /opt/rclone
cd /opt/rclone
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
sudo apt update # 更新軟體套件清單
sudo apt install unzip # 安裝 unzip 工具
unzip rclone-current-linux-amd64.zip # 解壓縮 rclone zip 檔案
cd rclone-*-linux-amd64 # 進入解壓縮後的 rclone 目錄
sudo cp rclone /usr/bin/ # 將 rclone 二進位檔案複製到 /usr/bin/ 目錄
sudo chown root:root /usr/bin/rclone # 設定檔案擁有者為 root:root
sudo chmod 755 /usr/bin/rclone # 設定檔案權限為 755,允許執行
#驗證安裝是否成功
rclone --version # 顯示 rclone 版本資訊
掛載到 rclone
安裝後就可以對 alist 進行掛載,輸入rclone config
注意第二步命名不能為 linux 中的資料夾!!!
之後一直按 Enter
輸入 q 即可退出
#檢查是否掛載成功
rclone lsd 自訂的名稱 (冒號不要少):
rclone lsd aliyunpan:
掛載到本機
其中
--dir-cache-time 1m:
目錄結構快取的有效期限為 1 分鐘--poll-interval 15s:
每 15 秒檢查遠端儲存的檔案變化 避免手動同步 rclone,alist 檔案更新後 1 分鐘就能更新到本機
掛載到本機
注意我這裡是阿里雲盤
# aliyunpan:/177 /mnt/177 為自訂
#格式為前面的名稱:/路径 /mnt/本機路徑
#記得提前建立好資料夾
rclone mount aliyunpan:/177 /mnt/177 \
--use-mmap \
--umask 000 \
--allow-other \
--allow-non-empty \
--dir-cache-time 1m \
--poll-interval 15s \
--cache-dir=/path/to/cache \
--vfs-cache-mode full \
--buffer-size 256M \
--vfs-read-chunk-size 32M \
--vfs-read-chunk-size-limit 512M \
--vfs-cache-max-size 10G \
--vfs-cache-max-age 1h \
--network-mode \
--no-check-certificate \
--default-permissions \
--header "Referer:https://www.aliyundrive.com/" \
--daemon
# 驗證是否掛載成功
df -H
查看本機資料夾,此時應該已經出現 alist 網盤中的內容
開機自動掛載
vim /etc/systemd/system/reclone.service
填寫
[Unit]
Description=rclone mount aliyunpan:/177 to /mnt/177
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/rclone mount aliyunpan:/177 /mnt/177 \
--use-mmap \
--umask 000 \
--allow-other \
--allow-non-empty \
--dir-cache-time 1m \
--poll-interval 15s \
--cache-dir=/path/to/cache \
--vfs-cache-mode full \
--buffer-size 256M \
--vfs-read-chunk-size 32M \
--vfs-read-chunk-size-limit 512M \
--vfs-cache-max-size 10G \
--vfs-cache-max-age 1h \
--network-mode \
--no-check-certificate \
--default-permissions \
--header "Referer:https://www.aliyundrive.com/"
ExecStop=/bin/fusermount -u /mnt/177
Restart=on-failure
TimeoutSec=30
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable reclone.service
sudo systemctl start reclone.service
sudo systemctl status reclone.service
安裝 jellyfin
docker pull jellyfin/jellyfin
# 建立 Jellyfin 資料資料夾
mkdir /opt/1panel/apps/jellyfin/config # 設定目錄掛載,jellyfin中的外掛都在該目錄下
mkdir /opt/1panel/apps/jellyfin/cache # 快取目錄掛載
# 字型檔案,避免jellyfin刮削出現白框
# 你reclone掛載檔案的位置
docker run -d \
--name jellyfin \
--net=host \
-e http_proxy=127.0.0.1:20172 \
-e https_proxy=127.0.0.1:20172 \
-e all_proxy=127.0.0.1:20172 \
--volume /opt/1panel/apps/jellyfin/config:/config \
--volume /opt/1panel/apps/jellyfin/cache:/cache \
--volume /usr/share/fonts:/usr/local/share/fonts \
--mount type=bind,source=/mnt,target=/mnt \
--restart=unless-stopped \
jellyfin/jellyfin
之後記得在阿里雲防火牆放行對應連接埠 8096
如果你沒有使用代理,使用豆瓣刮削器即可
沒有使用代理則刪除上面的三行
-e http_proxy=127.0.0.1:20172 \
-e https_proxy=127.0.0.1:20172 \
-e all_proxy=127.0.0.1:20172 \
安裝豆瓣刮削器
在 jellyfin 存儲庫 加入該連結 https://mirror.ghproxy.com/https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest_cn.json
伺服器端外掛安裝
/opt/1panel/apps/jellyfin/config/plugins
media 反向代理
/home/MediaLinker/
chen3861229/embyExternalUrl: 一些 emby/jellyfin 指令碼
docker run -d \
--name MediaLinker \
--network host \
-v /home/MediaLinker/:/opt/ \
thsrite/medialinker:latest
jellyfin 需要按照設定檔說明修改五處
const embyHost = "";
const embyApiKey = "";
const mediaMountPath = ["/mnt"];
const alistAddr = "";
// 注意 jellyfin 是小寫開頭 mediaSourceId
keyExpression: "r.uri:r.args.mediaSourceId", // "r.uri:r.args.MediaSourceId:r.args.X-Emby-Device-Id"
然後重新啟動 MediaLinker 即可 同樣記得放行 8091 連接埠
KODi
在 jellyfin 中安裝 infuse 和 kodi 外掛
infuse 和 Senplayer 等播放器都是加入jellyfin來源即可
Kodi | Jellyfin 官方介紹 kodi 需要安裝 jellyfin 官方庫Kodi | Jellyfin 官方庫
安裝 Jellyfin 即可,個人覺得 jellycon 沒有 jellyfin 好用,二選一就行
總結
jellyfin
http://127.0.0.1:8096
medialink
nginx連接埠,預設8091
nginx ssl連接埠,預設8095
自動將連接埠轉到後端的8096
其他問題
jellyfin 字型白框問題
Releases, notofonts, noto-cjk
下載 All Variable OTF/OTC
# 重新命名為例如noto-serif-cjk.zip
#傳到/usr/share/fonts/
cd /usr/share/fonts/
unzip noto-serif-cjk.zip
#重新整理字型快取
sudo fc-cache -fv
#刪除之前的封面並重新整理中繼資料
#然後重新啟動即可jellyfin和mediaLink(如果已經安裝)







