玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音


玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音


群暉nas安裝jellyfin很多大佬都寫過教程了,我就先等等再發了,到時候發一篇詳細的,適合小白上手的。

最近一直在折騰無限google drive,搬運各種資源到自己的雲盤,已經達到了痴迷的程度。其實手機端播放谷歌盤內的影音可以使用nplayer或者infuse,最近看到有些小夥伴總是問如何在vps搭載emby或者jellyfin並且播放谷歌雲盤內影音。博主看到後其實認為這種方式並不合適,因為這種使用網頁端播放就會在服務器端進行解碼,vps小雞那配置,估計會被卡爆,但是也不失為一種方式,這裡咱們試一下,看下效果。

博主搭載的是jellyfin,如果你使用emby搭載方式大同小異,可以網上找下教程。

Jellyfin

Jellyfin是一個自由軟件媒體系統,可讓您控制媒體的管理和流媒體。它是專有的Emby和Plex的替代品,可通過多個應用程序從專用服務器向終端用戶設備提供媒體。Jellyfin是Emby 3.5.2版本的後代,移植到.NET Core框架以支持完整的跨平臺支持。沒有任何附加條件,只是一個團隊想要更好地構建更好的東西並共同努力實現它,致力於讓所有用戶都能訪問最好的媒體系統。

開始安裝

所需工具

  1. vps服務器
  2. google drive

現在手上有個2核1g 30g硬盤的閒置小雞,基本上沒跑什麼東西,裝了個aria2和oneindex,一會看下播放影片的效果,現在小雞的狀態,可以看到小雞的cpu和內存基本上都沒怎麼佔用。

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

安裝jellyfin

這裡需要注意一點,網上有docker的安裝教程,這裡我們使用的是軟件包安裝,因為博主使用docker安裝後發現jellyfin無法添加掛載的谷歌雲盤作為媒體庫,所以小夥伴們最好使用軟件包安裝。

登錄jellyfin官網(jellyfin.rog)下載對應的軟件包,我的vps安裝的debain9,找到對應的安裝包下載。


玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音


玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音


將下載好的軟件包上傳到vps的root目錄下,查看下是否上傳成功

ls

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

#安裝軟件包

dpkg -i jellyfin_10.0.0-1_amd64.deb

#更新系統

apt update

#如果報錯,再自動修復並安裝下依賴和軟件

apt -f install -y

#查看狀態

service jellyfin status

#開機自啟

systemctl enable jellyfin

安裝完上面的命令就可以用ip:8096打開jellyfin了。這裡我們先不做設置,先把google drive掛載到vps。

掛載google drive

#安裝rclone

wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh


#初始化設置

rclone config


n) New remote

s) Set configuration password

q) Quit config

n/s/q> n #新建

name> g #給掛載谷歌盤命名,我為了方便命名為g

Type of storage to configure.

Enter a string value. Press Enter for the default ("").

Choose a number from below, or type in your own value

1 / 1Fichier\\ "fichier"

2 / Alias for an existing remote\\ "alias"

3 / Amazon Drive\\ "amazon cloud drive"

4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)\\ "s3"

5 / Backblaze B2\\ "b2"

6 / Box\\ "box"

7 / Cache a remote\\ "cache"

8 / Citrix Sharefile\\ "sharefile"

9 / Dropbox\\ "dropbox"

10 / Encrypt/Decrypt a remote\\ "crypt"

11 / FTP Connection\\ "ftp"

12 / Google Cloud Storage (this is not Google Drive)\\ "google cloud storage"

13 / Google Drive\\ "drive"

14 / Google Photos\\ "google photos"

15 / Hubic\\ "hubic"

16 / In memory object storage system.\\ "memory"

17 / JottaCloud\\ "jottacloud"

18 / Koofr\\ "koofr"

19 / Local Disk\\ "local"

20 / Mail.ru Cloud\\ "mailru"

21 / Mega\\ "mega"

22 / Microsoft Azure Blob Storage\\ "azureblob"

23 / Microsoft OneDrive\\ "onedrive"

24 / OpenDrive\\ "opendrive"

25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)\\ "swift"

26 / Pcloud\\ "pcloud"

27 / Put.io\\ "putio"

28 / QingCloud Object Storage\\ "qingstor"

29 / SSH/SFTP Connection\\ "sftp"

30 / Sugarsync\\ "sugarsync"

31 / Transparently chunk/split large files\\ "chunker"

32 / Union merges the contents of several remotes\\ "union"

33 / Webdav\\ "webdav"

34 / Yandex Disk\\ "yandex"

35 / http Connection\\ "http"

36 / premiumize.me

\\ "premiumizeme"

Storage> 13 #選擇google drive 13

** See help for drive backend at: https://rclone.org/drive/ **

Google Application Client Id

Setting your own is recommended.See https://rclone.org/drive/#making-your-own-client-id for how to create your own.If you leave this blank, it will use an internal key which is low performance.Enter a string value. Press Enter for the default ("").

client_id> #回車

Google Application Client Secret

Setting your own is recommended.

Enter a string value. Press Enter for the default ("").

client_secret> #回車

Scope that rclone should use when requesting access from drive.

Enter a string value. Press Enter for the default ("").

Choose a number from below, or type in your own value

1 / Full access all files, excluding Application Data Folder.\\ "drive"

2 / Read-only access to file metadata and file contents.\\ "drive.readonly"/ Access to files created by rclone only.

3 | These are visible in the drive website.| File authorization is revoked when the user deauthorizes the app.\\ "drive.file"/ Allows read and write access to the Application Data folder.

4 | This is not visible in the drive website.\\ "drive.appfolder"/ Allows read-only access to file metadata but

5 | does not allow any access to read or download file content.\\ "drive.metadata.readonly"

scope> 1 #選擇1

ID of the root folder

Leave blank normally.

Fill in to access "Computers" folders (see docs), or for rclone to usea non root folder as its starting point.

Note that if this is blank, the first time rclone runs it will fill itin with the ID of the root folder.

Enter a string value. Press Enter for the default ("").

root_folder_id> #回車

Service Account Credentials JSON file path

Leave blank normally.

Needed only if you want use SA instead of interactive login.

Enter a string value. Press Enter for the default ("").

service_account_file> #回車

Edit advanced config? (y/n)

y) Yesn)

No (default)

y/n> #回車

Remote config

Use auto config?

* Say Y if not sure

* Say N if you are working on a remote or headless machine

y) Yes (default)

n) No

y/n> n

Please go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=202264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapisFW6Ur8TYodFCYlg #把這個網址複製到瀏覽器授權rclone 得到授權碼

Log in and authorize rclone for access

Enter verification code> #粘貼上面得到的授權碼

Configure this as a team drive?

y) Yes

n) No (default)

y/n> #回車

--------------------

[g]

type = drive

scope = drive

token = {"access_token":"}

--------------------

y) Yes this is OK (default)

e) Edit this remote

d) Delete this remote

y/e/d> #回車

Current remotes:

Name Type

==== ====

g drive

e) Edit existing remote

n) New remote

d) Delete remote

r) Rename remote

c) Copy remote

s) Set configuration password

q) Quit config

e/n/d/r/c/s/q> q

新建掛載目錄,注意此處目錄千萬不要建立在root文件夾下,否則jellyfin無法讀取

mkdir /gdrive

cd /gdrive

mkdir disk


#掛載為磁盤,下面的DriveName、Folder、LocalFolder參數根據說明自行替換

rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

DriveName為初始化配置填的name即為g,Folder為Google Drive裡的文件夾即留空即可,LocalFolder為VPS上的本地文件夾即為/gdrive/disk。

故命令為

rclone mount g: /gdrive/disk --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemon


#查看是否掛載成功

df -h

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

看到已經掛載成功了大小1p,實際是無限容量的盤。

設置開機啟動

command="mount g: /gdrive/diskroot/bak --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000"

#以下是一整條命令,一起復制到SSH客戶端運行

cat > /etc/systemd/system/rclone.service <

[Unit] Description=Rclone

After=network-online.target


[Service]

Type=simple

ExecStart=$(command -v rclone) ${command}

Restart=on-abort

User=root


[Install]

WantedBy=default.target

EOF

初始化jellyfin

ip:8096打開jellyfin

語言設置

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

這裡需要設置媒體庫的文件夾,點擊加號

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

點擊folders加號

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

選擇根目錄-gdrive-disk後面就能選擇你googledrive下的目錄了

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

可以看到設置媒體庫完成了

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

語言和國家

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

後面一路下一步就行了。

最後安裝好了,就自行去後臺設置,轉碼那裡還需要你填上ffmpeg路徑,一般為/usr/bin,可使用which ffmpeg查看路徑。

測試效果

現在jellyfin應該還在掃描剛才設置好的媒體庫,我們去看下cpu內存的情況

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

可以看到主要還是cpu佔用較高,但是並非總是100%佔用,現在這個小雞的情況是最高90%左右。

速度測試

480p清晰度,播放速度沒問題,拖拽進度條會有少許等待,可以看到cpu佔用不是特別高,偶爾達到90%左右


玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音


玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音


玩轉Nas-014,vps安裝jellyfin並播放掛載google drive盤內影音

720p清晰度,cpu90%佔用時間明顯增多,播放基本流暢,拖拽進度條需等待。

更高清晰度,基本就是卡頓比較嚴重了。

寫在最後

博主也看到網上有很多教程,關於vps安裝jellyfin或者emby的,但是我真心不知道他們是如何做到服務端解碼然後流暢播放高清晰度電影的,卡不卡頓和兩個因素有關,一個是vps的網絡環境,一個是配置是否夠高。

我昨天用了一個1核1g的測試,觀看效果比今天2核1g的強一些,我感覺應該是昨天的vps的網絡環境好一些。

博主自己主要還是用nas端的jellyfin來觀影,google drive用infuse,這個完全是看到很多小夥伴問如何掛載設置才寫的教程,也算是個思路,感興趣的可以嘗試下,教程寫的非常詳細了。

博主也曾想過如何讓jellyfin讀取掛載在nas上的google drive,不過沒有找到方法,不知道有沒有大神實現,煩請指教一二。

好了,我是小羊shawn,一隻愛折騰的土木羊,歡迎關注一波!


分享到:


相關文章: