First, let's showcase the Emby images.
Folder Preparation#
!!!!!Please read everything before looking at the complete installation example at the end!!!!!
!!!!!If your media library has a small number of items, you can choose not to deploy auto-symlink. This is just to replace dozens of GB of media files with a few KB-sized strm files to speed up Emby library scanning! It is not mandatory!!!!! If you have a particularly large media library, such as ten thousand movies, then you can choose to deploy auto-symlink, which will allow Emby to scan the library in seconds!!!!! Note! If you do not deploy auto-symlink, you do not need to create a strm folder; when adding folders to the Emby media library, you 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 for 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 will need to change the name replacement; 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 you want to watch to mp via WeChat, mp will automatically download to the "1" directory, and after downloading, it will automatically scrape and transfer to the "2" directory.
After the transfer is complete, auto-symlink will monitor changes in the "2" directory, automatically generate the corresponding STRM files, and copy the corresponding metadata (nfo, jpg, etc.) to the "3" folder. Then Emby reads the "3" folder for playback.
The content of the strm file is the media's corresponding "2" address!!! 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, indicating that Emby playback is directly linked to the cloud disk, 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 match 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 via 8099 for direct linking!!! This means the original Emby address was 10.10.10.10:8096, and you must access 10.10.10.10:8099. If reverse proxying, it will reverse proxy the 8099 port. 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 out before discussing the others.
Line 9: Emby's apikey, found in
Settings - API Key
; if not present, create a new one; if present, use it directly.Line 11: The domain name for alist
Line 12: The port for alist
Line 17: The token for alist, found in
Backend - Settings - Other - Token
Optional modifications
Line 21: Although it is said to be optional, it is recommended to fill it in!!
Line 25: Line 25 has the same effect as line 7; choose one to fill in!! Do not write both!!
Here’s how to fill in line 7 and line 25
In the first step of folder preparation, we obtained five paths:
The download directory for 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/mediaThe soft 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.This means that 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.This means that the two paths start with one being
/115alist
and the other being/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, the first part is the Emby path, the second part is the alist path)
At this point, opening 10.10.10.10 port will allow direct linking to the cloud disk for playback.
Check if Direct Link Works#
Check Method 1:#
Use various clients, such as the official Emby client, Infuse, Fileball, Vidhub, etc., to log in to the nginx port (e.g., 8099), find a scraped movie to play, or redirect to a third-party player like PotPlayer or iina.
Check the download tasks in CD2. If there are no large file downloads, 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 (e.g., 8099), find a scraped movie to play, or redirect to a third-party player like PotPlayer or iina.
Check the nginx logs. If the following direct link addresses appear, it indicates that the direct link was successful, and at this point, the traffic does not pass through the server where Emby is deployed
. It does not occupy the VPS or home bandwidth upload.
Troubleshooting:#
1: If playback is possible and there is an EmbyServer process, then you are using Emby's port, so it can release; please log in to Emby using the nginx port for release testing.
2: If using the nginx port and playback is not possible, then the path must be wrong; check the nginx configuration file and the mapping paths for Emby, alist, and cd2!!!
Complete Installation Example#
!!!!!If your media library has a small number of items, you can choose not to deploy auto-symlink. This is just to replace dozens of GB of media files with a few KB-sized strm files to speed up Emby library scanning! It is not mandatory!!!!! If you have a particularly large media library, such as ten thousand movies, then you can choose to deploy auto-symlink, which will allow Emby to scan the library in seconds!!!!!
This installation example includes the deployment of auto-symlink
This installation example assumes that there are already some films in the media library, and they have been scraped properly.
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 for 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 mounting process.
- Soft link STRM folder
For example: /share/Drive/115STRM/media
The mount paths for alist and cd2 must be the same!! Otherwise, nginx will need to change the name replacement; 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
Deploying 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 for mp after mounting the cloud disk with cd2, e.g., /share/Drive/115/downloads
# 2. The media library directory organized by mp after mounting the cloud disk with cd2, e.g., /share/Drive/115/media
# 3. Soft link STRM folder (can be skipped if not deploying auto-symlink), e.g., /share/Drive/115STRM/media
# Mount path for alist when mounting the cloud disk, e.g., /115
# Mount path for cd2 when mounting the cloud disk, e.g., /115
Open the browser and enter username admin
, password password
to log in.
Add Synchronization#
Task Name: Any name
Media Directory: Change to your own; if your folder preparation is the same as mine, it will be exactly the same here.
Local Directory: Change to your own; if your folder preparation is the same as mine, it will be exactly the same here.
Metadata Mode: Local Mode
Soft Link Mode: strm
Strm Mode: local
Other options should be the same as mine.
Global Settings#
Manual Synchronization#
After manually synchronizing once, mp will automatically monitor the media folder after organizing the media library, and if there are changes in the media folder, it will create or delete strm files and metadata.
After clicking start synchronization, click view logs, and it will output the logs for creating strm files and copying nfo and jpg. At this point, the strm folder will contain strm files that Emby can read.
Deploying 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 four lines are for Emby to use the proxy
#- HTTP_PROXY=http://10.10.10.1:7890 This is to download actor images and collection images to the metadata directory when refreshing media metadata
#- HTTPS_PROXY=http://10.10.10.1:7890
#- 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 for mp after mounting the cloud disk with cd2, e.g., /share/Drive/115/downloads
# 2. The media library directory organized by mp after mounting the cloud disk with cd2, e.g., /share/Drive/115/media
# 3. Soft link STRM folder (can be skipped if not deploying auto-symlink), e.g., /share/Drive/115STRM/media
# Mount path for alist when mounting the cloud disk, e.g., /115
# Mount path for cd2 when mounting the cloud disk, e.g., /115
Add Media Library Folder#
Add the media library, select the strm folder (if not deploying auto-symlink, just select the cd2 mounted 115 cloud disk directory).
Media Library Settings#
Only enable Enable Real-time Monitoring and Metadata Reader; 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 summaries. However, there will be no actor images (as long as this is your first installation of Emby, and there is no metadata folder in the Emby config folder, there cannot be actor images). At this point, reconfigure the Media Library Settings.
Reconfigure Media Library Settings#
Select all options related to Metadata Downloaders
and Image Fetchers
to TheMovieDB
, and do not check any others!!!!!
After setting, click Refresh Media Metadata to overwrite all metadata (it will not overwrite the nfo files because we did not check the metadata storage method). Do not check Replace All Images, just click Refresh. Wait for the refresh to complete, and then open a movie to see the actor images.
Click on any movie or TV show, scroll down to the bottom, and you can see STRM text
and STRM file content
. At this point, the 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 playback.
Deploying 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 via 8099 for direct linking!!! This means the original Emby address was 10.10.10.10:8096, and you must access 10.10.10.10:8099. If reverse proxying, it will reverse proxy the 8099 port. 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 via 8099 for direct linking!!! This means the original Emby address was 10.10.10.10:8096, and you must access 10.10.10.10:8099. If reverse proxying, it will reverse proxy the 8099 port. 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#
You can now open various clients, such as the official Emby client, Infuse, Fileball, Vidhub, etc., and log in to nasip:nginx port
or the reverse proxy address for playback testing.
How to test if it is a direct link is explained above — Check if Direct Link Works
Common Issues#
How to set the Emby mount path?
Map the absolute path, then compare the media information paths in Emby with the paths in alist, and modify the nginx configuration file accordingly.
If you installed auto-symlink, you also need to map a strm path.
Which port does Emby use?
Use the nginx port. It is not possible to directly link to the cloud disk using Emby's port.
Can the network mode of Emby be changed to bridge?
No, it can only be host; at least that’s what I tested.
Can the alist address in the nginx configuration file be filled with an internal address?
I tried it, and it cannot play externally. So it is recommended to fill in the external address of alist.
Why does the auto-symlink log overwrite nfo files during full synchronization at 2:30 every day?
This happens because the Metadata Storage Method was checked during Emby media library settings; uncheck this option.
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 no EmbyServer process in the cd2 background, it means it is a direct link.
Can the STRM folder be set arbitrarily?
Yes, you can change it freely.
Can auto-symlink monitor in real-time, automatically creating strm and copying metadata after media is added?
Yes, but there are conditions: 1. You need to have a membership for coulddrive2. 2. It can only move or copy within local or coulddrive2. MoviePilot can monitor in real-time.
Can I use Emby to scrape, and auto-symlink only create strm files?
Yes, during the synchronization setup, just write a non-existent suffix in the last option Sync Suffix - Metadata Suffix because it cannot be completely deleted, for example,.haha cannot be deleted
(note: it must start with a dot “.”) and then check Metadata Storage Method in the Emby media library settings.
Can I change to another cloud disk and directly link to play from there?
Yes, just change/115
to the cloud disk name, and everything else 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’s what I tested. Then it has a buffering period, meaning after synchronizing one or a few movies, it will rest for two to three minutes before synchronizing the next movie or TV show.