Show some Emby images first
Folder Preparation#
!!!!!Read everything before looking at the complete installation example at the end!!!!!
!!!!!If your media library is small, you can choose not to deploy auto-symlink. This is just to replace dozens of GB of media files with a few KB strm files to speed up Emby library scanning! It is not mandatory!!!!! If you have a particularly large media library, like ten thousand movies, then you can choose to deploy auto-symlink, so Emby can complete the library scan in seconds!!!!! Note! If you do not deploy auto-symlink, you do not need to create the strm folder. When adding folders to the Emby media library, select the media library path after the cd2 mount!!!!!
Prepare three folders and one mount path for the alist mounted cloud disk, and one mount path for the cd2 mounted cloud disk (if not deploying auto-symlink, just prepare two folders).
- The download directory of mp after mounting the cloud disk with cd2
For example: /share/Drive/115/downloads
- The media library directory organized by mp after mounting the cloud disk with cd2
For example: /share/Drive/115/media
- Soft link STRM folder (can be skipped if not deploying auto-symlink)
For example: /share/Drive/115STRM/media
The mount paths for alist and cd2 must be the same!! Otherwise, nginx needs to be changed to name replacement, and if they are the same, no changes are needed.#
Mount path for alist when mounting the cloud disk
For example: /115
Mount path for cd2 when mounting the cloud disk
For example: /115
The media folder contains primary and secondary directories.
/share/Drive/115/media/Movies/Western Movies
/share/Drive/115STRM/media/TV Shows/Western Series
Explanation:
Send the movies to watch to mp via WeChat, mp automatically selects and downloads to this "1" directory. After downloading, it automatically scrapes and transfers to this "2" directory.
After the transfer is complete, auto-symlink monitors changes in the "2" directory, automatically generates corresponding STRM files, and copies corresponding metadata (nfo, jpg, etc.) to this "3" folder. Then Emby reads this "3" folder for playback.
The content of the strm file is the corresponding "2" address of the media!!! During playback, it calls the "2" address for playback, so when nginx is not set up, there will be an EmbyServer process in the cd2 background download. After setting up nginx, there will be no EmbyServer process in the cd2 background, which means Emby playback is directly linked to the cloud disk playback, not occupying upload bandwidth!
Emby Directory Mapping Notes#
Emby needs to map both the "2" and "3" directories!!!
And when mapping the "2" directory, the right side of the colon must be an absolute path!
When mapping the "3" directory, the right side of the colon can be any mapping path.
When adding folders to the media library, select the "3" directory!!!!!!!!
For example:
“2” path: /share/Drive/115
“3” path: /share/AAAA/STRRM
Then map like this
- '/share/Container/Emby:/config'
- '/share/Drive/115:/share/Drive/115'
- '/share/AAAA/STRRM:/STRM'
Then when adding folders to the Emby media library, select
For example: /STRM/TV Shows/Western Series
For example:
“2” path: /share/Drive/115/media
“3” path: /share/Drive/115STRM/media
Then map like this
volumes:
- '/share/Container/Emby:/config'
- '/share/Drive:/share/Drive'
Then when adding folders to the Emby media library, select
For example: /share/Drive/115STRM/media/TV Shows/Western Series
Auto-symlink Directory Mapping Notes#
(Can be skipped if not deploying auto-symlink)
Auto-symlink must be consistent with the "2" directory, and the right side of the colon must be an absolute path!
For example:
“2” path: /share/Drive/115
“3” path: /share/AAAA/STRRM
Then map like this
volumes:
- /share/AAAA/STRRM:/share/AAAA/STRRM #strm directory
- /share/Drive/115:/share/Drive/115:rslave #media library directory
- /share/Container/STRM/config:/app/config
For example:
“2” path: /share/Drive/115/media
“3” path: /share/Drive/115STRM/media
Then just map like this.
volumes:
- /share/Drive:/share/Drive:rslave #includes strm directory and media library directory
- /share/Container/STRM/config:/app/config
Nginx Notes#
Note 1: Which port does Emby use#
If your nginx port mapping is like this
ports:
- 8099:80
Then Emby can only be accessed through 8099!!! That is, the original Emby address is 10.10.10.10:8096, and you must access 10.10.10.10:8099. If reverse proxying, it will reverse proxy this port 8099. The 8099 port can be changed freely.
Note 2: Modify the constant.js file#
Click to download the nginx configuration file
The lines to modify are 4, 7, 9, 11, 12, and 17.
Required modifications
Line 4: Fill in the internal network address of Emby, Emby needs host mode!!!
Line 7: Key point, fill this in before discussing others.
Line 9: Emby's apikey, found in
Settings - API Key
, create a new one if there isn't one, or use the existing one.Line 11: Domain name of alist
Line 12: Port of alist
Line 17: Token of alist, found in
Backend - Settings - Other - Token
Optional items
Line 21: It is said to be optional, but it is recommended to fill it in!!
Line 25: Line 25 and line 7 have the same effect, choose one to fill in!! Do not write both!!
Teach you how to fill in line 7 and line 25
When we prepared the folders in the first step, we obtained 5 paths, which are:
The download directory of mp after mounting the cloud disk with cd2
For example: /share/Drive/115/downloadsThe media library directory organized by mp after mounting the cloud disk with cd2
For example: /share/Drive/115/mediaSoft link STRM folder
For example: /share/Drive/115STRM/mediaMount path for alist when mounting the cloud disk
For example: /115Mount path for cd2 when mounting the cloud disk
For example: /115At this point
The media path for alist is: /115/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
The media path for Emby is: /share/Drive/115/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
It can be seen that the paths after
/115
are exactly the same.That is, Emby's media path has an additional
/share/Drive
:
/115/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
/share/Drive/115/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
At this point, line 7 should be filled with:
"/share/Drive"
(with double quotes)
If your alist and cd2 cloud disk mapping paths are inconsistent, then fill in line 25
Mount path for alist when mounting the cloud disk
For example: /115alistMount path for cd2 when mounting the cloud disk
For example: /115cd2At this point
The media path for alist is: /115alist/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
The media path for Emby is: /share/Drive/115cd2/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
It can be seen that the paths after
/media
are exactly the same.That is, the starting paths are
/115alist
and/share/Drive/115cd2
/115alist/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
/share/Drive/115cd2/media/Movies/Western Movies/Spider-Man/Spider-Man.mkv
At this point, line 25 should be filled with:
"/share/Drive/115cd2", "/115alist"
(with double quotes, fill in the Emby path first, then the alist path)
At this point, opening 10.10.10.10 port will allow direct linking to cloud disk playback.
Check if Direct Link#
Check Method 1:#
Use various clients, such as the official Emby client, Infuse, Fileball, Vidhub, etc., to log in to the nginx port (like 8099), find a scraped movie to play, or web jump to third-party players like PotPlayer, iina, etc.
Check the CD2 download tasks. If there are no large corresponding files being downloaded, and the process is /system/EmbyServer
, it means the 302 forwarding was successful.
Check Method 2:#
Use various clients, such as the official Emby client, Infuse, Fileball, Vidhub, etc., to log in to the nginx port (like 8099), find a scraped movie to play, or web jump to third-party players like PotPlayer, iina, etc.
Check the nginx logs. If the following direct link addresses appear, it indicates a successful direct link, and at this point, the traffic does not go through the server where Emby is deployed
. It does not occupy the upload bandwidth of VPS or home network.
Troubleshooting:#
1: If it can play and there is an EmbyServer process, then you are using Emby's port, so it can release. Please use the nginx port to log in to Emby for release testing.
2: If you use the nginx port and cannot play, then the path is incorrect. Check the nginx configuration file and the mapping paths for Emby, alist, and cd2!!!
Complete Installation Example#
!!!!!If your media library is small, you can choose not to deploy auto-symlink. This is just to replace dozens of GB of media files with a few KB strm files to speed up Emby library scanning! It is not mandatory!!!!! If you have a particularly large media library, like ten thousand movies, then you can choose to deploy auto-symlink, so Emby can complete the library scan in seconds!!!!!
This installation example has deployed auto-symlink
This installation example assumes that there are already some films in the media library and that scraping has been done.
Folder Preparation#
Three folders and one mount path for alist when mounting the cloud disk, and one mount path for cd2 when mounting the cloud disk.
- The download directory of mp after mounting the cloud disk with cd2
For example: /share/Drive/115/downloads
- The media library directory organized by mp after mounting the cloud disk with cd2
For example: /share/Drive/115/media
Paths 1 and 2 are completed during the cd2 mount.
- Soft link STRM folder
For example: /share/Drive/115STRM/media
The mount paths for alist and cd2 must be the same!! Otherwise, nginx needs to be changed to name replacement, and if they are the same, no changes are needed.#
Mount path for alist when mounting the cloud disk
For example: /115
Mount path for cd2 when mounting the cloud disk
For example: /115
Deploy Auto-symlink#
version: "3.8"
services:
auto_symlink:
container_name: auto_symlink
environment:
- TZ=Asia/Shanghai
volumes:
#- /share/Drive:/share/Drive #strm directory
- /share/Drive:/share/Drive:rslave #media library directory
- /share/Container/STRM/config:/app/config
ports:
- 8095:8095
user: 0:0
logging:
options:
max-size: 10m
max-file: 3
restart: unless-stopped
image: shenxianmq/auto_symlink:latest
networks: {}
# This is just to help you understand why I mounted the folders this way...
# 1. The download directory of mp after mounting the cloud disk with cd2 For example: /share/Drive/115/downloads
# 2. The media library directory organized by mp after mounting the cloud disk with cd2 For example: /share/Drive/115/media
# 3. Soft link STRM folder (can be skipped if not deploying auto-symlink) For example: /share/Drive/115STRM/media
# Mount path for alist when mounting the cloud disk For example: /115
# Mount path for cd2 when mounting the cloud disk For example: /115
Open the browser, enter username admin
, password password
to log in.
Add Synchronization#
Task name: Random
Media directory: Change to your own; if your folder preparation is exactly the same as mine, then it will be exactly the same here.
Local directory: Change to your own; if your folder preparation is exactly the same as mine, then it will be exactly the same here.
Metadata mode: Local mode
Soft link mode: strm
Strm mode: local
Other options are the same as mine.
Global Settings#
Manual Synchronization#
After manually synchronizing once, mp will automatically monitor the media folder after organizing media into the library. If it detects changes in the media folder, it will create or delete strm files and metadata.
After clicking start synchronization, click to view the logs, and it will output the logs for creating strm files and copying nfo and jpg. At this point, the strm folder will have strm files that Emby can read.
Deploy Emby#
version: '3.8'
services:
linuxserver:
container_name: Emby
network_mode: host
environment:
- PUID=0
- PGID=0
- TZ=Asia/Shanghai
#- NO_PROXY=172.17.0.1,127.0.0.1,localhost These 4 lines are for Emby to use the proxy
#- HTTP_PROXY=http://10.10.10.1:7890 This way, when refreshing media metadata
#- HTTPS_PROXY=http://10.10.10.1:7890 it will download actor images and collection images to the metadata directory
#- ALL_PROXY=http://10.10.10.1:7890 If the NAS itself uses a proxy, then these four lines can be omitted
volumes:
- '/share/Container/Emby:/config'
- '/share/Drive:/share/Drive'
devices:
- '/dev/dri:/dev/dri'
restart: unless-stopped
image: 'lscr.io/linuxserver/emby:beta'
# This is just to help you understand why I mounted the folders this way...
# 1. The download directory of mp after mounting the cloud disk with cd2 For example: /share/Drive/115/downloads
# 2. The media library directory organized by mp after mounting the cloud disk with cd2 For example: /share/Drive/115/media
# 3. Soft link STRM folder (can be skipped if not deploying auto-symlink) For example: /share/Drive/115STRM/media
# Mount path for alist when mounting the cloud disk For example: /115
# Mount path for cd2 when mounting the cloud disk For example: /115
Add Media Library Folder#
Add the media library, select the strm folder (if not deploying auto-symlink, just select the directory of the cd2 mounted 115 cloud disk).
Media Library Settings#
Only enable Enable Real-time Monitoring and Metadata Reader, and do not check any other options related to metadata downloaders! Metadata Storage Method must not be checked.
After saving, Emby should complete the library scan in seconds.
Since we set up synchronization of soft links and metadata during auto-symlink, the strm folder will have a strm file
replacing the media file, along with an nfo
file and jpg
images. Therefore, when Emby completes the library scan, there will be posters and descriptions. However, there will be no actor images (as long as this is your first time installing Emby, and there is no metadata folder in the Emby config folder, there will be no actor images). At this point, reset the Media Library Settings.
Reset Media Library Settings#
Select all options related to Metadata Downloaders
and Image Fetchers
to TheMovieDB
, and do not check any other options!!!!!
After setting, click to refresh media metadata to directly overwrite all metadata (it will not overwrite the nfo file because we did not check the metadata storage method). Do not check replace all images, click refresh. After waiting for the refresh to complete, open a movie, and you will see actor images.
Click on any movie or TV show, scroll down to the bottom, and you can see the STRM text
and STRM file content
. At this point, Emby deployment is complete. The next step is to hijack the Emby playback address to the real playback address of the alist cloud disk for direct linking to cloud disk playback.
Deploy Nginx#
version: '3'
services:
nginx:
image: registry.cn-shenzhen.aliyuncs.com/hicane/emby-nginx:latest
container_name: nginx
network_mode: bridge
ports:
- 8099:80 #Emby can only be accessed through 8099 for direct linking!!! That is, the original Emby address is 10.10.10.10:8096, and you must access 10.10.10.10:8099. If reverse proxying, it will reverse proxy this port 8099. The port can be changed freely.
volumes:
- /share/Container/nginx/constant.js:/etc/nginx/conf.d/constant.js
restart: unless-stopped
Set Emby Port#
As shown above, I mapped to 8099, so Emby can only be accessed through 8099 for direct linking!!! That is, the original Emby address is 10.10.10.10:8096, and you must access 10.10.10.10:8099. If reverse proxying, it will reverse proxy this port 8099. The port can be changed freely.
Modify the constant.js file#
Click to download the nginx configuration file
How to modify is explained above — Note 2: Modify the constant.js file
All Deployments Completed#
Now you can open various clients, such as the official Emby client, Infuse, Fileball, Vidhub, etc., to log in to nasip:nginx port
or reverse proxy address for playback testing.
How to test if it is a direct link is explained above — Check if Direct Link
Common Issues#
How to set the Emby mount path?
Map the absolute path, then compare the media information in Emby with the path in alist, and modify the nginx configuration file accordingly.
If auto-symlink is installed, you also need to map a strm path.
Which port does Emby use?
Use the nginx port. It is impossible to directly link to cloud disk playback using Emby's port.
Can the network mode of Emby be changed to bridge?
No, it can only be host; at least that is how I tested it.
Can the alist address in the nginx configuration file be filled with an internal network address?
I have tried, and it cannot play externally. So it is recommended to fill in the external address of alist.
Why does the auto-symlink log overwrite the nfo file during full synchronization at 2:30 every day?
This is because the Metadata Storage Method was checked during Emby media library settings. Just uncheck it.
How to determine if Emby playback is a direct link to the cloud disk?
The simplest way is to play a video using the nginx port. If there is a process in the cd2 background and no EmbyServer process, it is a direct link.
Can the STRM folder be set freely?
Yes, you can change it as you like.
Can auto-symlink monitor in real-time, automatically creating strm and copying metadata after media is added?
Yes, but with conditions: 1. You need to have a membership for coulddrive2. 2. It can only move or copy locally or within coulddrive2. MoviePilot can monitor in real-time.
Can I use Emby to scrape, and auto-symlink only create strm files?
Yes, during the synchronization addition, the last option Synchronization Suffix - Metadata Suffix can be filled with any non-existent suffix because it cannot be completely deleted, for example,.haha cannot be deleted
(note: it must start with a dot “.”), then check the Metadata Storage Method in Emby media library settings.
Can I change to another cloud disk and directly link to play from that cloud disk?
Yes, just change/115
to the name of the cloud disk, and the rest remains the same.
Why is auto-symlink real-time monitoring not effective?
It needs to perform a full synchronization first to take effect; at least that is how I tested it. Then it has a buffering period, meaning after synchronizing one or a few movies, it will rest for two or three minutes before synchronizing the next movie or TV show.