Contents
- 1 Preface
- 2 Improve the loading speed of poster wall images
- 3 Solve the scraping problem of tmdb plugin in emby
- 3.1 Reasons why the tmdb plugin cannot scrape normally
- 3.2 The domain name used by the tmdb plugin
- 3.3 No science or magic environment
- 3.4 A scientific or magical environment
- 4 Export emby's film and television resource data
- 5 Poster wall cover picture enhancement
- 6 How to save multiple versions of the same movie at the same time
- 7 Non-feature content
- 8 Afterword
Preface
I have written relatively few articles about emby, mainly because I really don’t think there is anything worth writing about, there is no technical content, and there are a lot of introductory tutorials on the Internet.
However, because I just completed the finishing work of the large data migration after purchasing the hard disk yesterday, I am already in the mood to optimize the slow loading problem of the poster wall in the media library of the demonstration site (some resources were previously placed on different Black Synology devices due to insufficient space and were usually not turned on. Now, except for European and American movies, all resources are concentrated on my QNAP NAS TS453Bmini and it is turned on 24 hours a day, so there is room for optimization).
The space for just writing about optimization is too small, and I still need to make up the word count, so I'll take this opportunity to briefly summarize the so-called "advanced" functions that I found useful when using emby. It's definitely not complete, and I'll slowly add new functions as I think of them in the future.
Improve the loading speed of poster wall images
When I was building the emby experience server, for convenience, I installed my emby server directly on the win11 virtual machine, and then mapped all the NAS shared folders where the film and television resources were located to the network disks on the win11 virtual machine, and added the media library using these network disks as paths:
Although the emby experience server can be used, I often have to wait for more than 10 seconds or even longer for the cover image to appear when opening a certain media library. This is because the hard disk on my NAS will be in a dormant state when no one is accessing it, and the cover image of each film and television resource is usually placed directly in the folder of each film and television resource:
Therefore, when you open the media library and need to read the cover image of the film and television resources, you need to first wake up the dormant hard drive where the film and television resources are located on the NAS. This takes more than 10 seconds.
The reason for this problem is that I checked the following option in emby's media library:
So if the emby server and media resources are not on the same device, but are accessed through network mounting (including mounting various network disks directly to emby), and there is a similar situation as mine where the poster cover image loads slowly, the options are recommended as follows:
If you previously checked the option "Save media images in media folders" and then unchecked it, you need to check "Replace existing images" in "Refresh media metadata" and refresh it for it to take effect:
allowableEmby-Server\programdata\metadata\library
Go to the path to view the refresh effect. For example, my emby experience server is installed on a win11 virtual machine, so the installation path is as follows:
C:\Users\username\AppData\Roaming\Emby-Server\programdata\metadata\library
:
When refreshing, you can see the modified folders in this directory. Click on any folder to see the pictures being refreshed (actor portraits, cover pictures, etc.)
Note: If there are a lot of resources, it will take a long time, so please be mentally prepared.
Solve the scraping problem of tmdb plugin in emby
Reasons why the tmdb plugin cannot scrape normally
In fact, the scraping recognition rate of the tmdb plug-in on emby is very high. Whether it is a movie, cartoon or TV series, my recognition rate is above 99%, and basically no manual intervention is required:
However, due to well-known reasons, the plug-in cannot be used normally in the normal domestic network environment. The reason is: DNS pollution. This is the most common way to deal with foreign websites that pose a threat that is neither big nor small. The specific method is to provide incorrect resolution results for the domain name on all domestic DNS. However, due to the low threat level, other more extreme treatment methods (such as target IP blocking, SNI blocking, etc.) have not been carried out for the time being. In other words, as long as the DNS pollution is resolved and the correct IP address of tmdb is obtained, and then some small operations are performed on the host where the emby server is located, normal communication can be achieved.
In fact, this problem still needs to be solved when using TMM, but TMM has other functions besides scraping, such as renaming, moving location, etc. So if you don’t need to rename or move the file location, as long as the DNS pollution problem is solved, you can use the tmdb plug-in for scraping normally.
The domain name used by the tmdb plugin
For the tmdb plugin to work properly, there are two domain names that need to be resolved correctly:
1.api.themoviedb.org
This domain name is required when using the tmdb plug-in to scrape the metadata of film and television resources. If the media library type is "Movie", you need to confirm that the "Movie Metadata Downloader" in the media library is "TheMovieDb", as shown below:
Similarly, if the media library type is "TV Shows", you need to confirm that "TV Show Metadata Downloader" is selected as "TheMovieDb".
2. image.tmdb.org
This domain name is required when using the tmdb plug-in to obtain data related to images such as cover images and banners of film and television resources. If the media library type is "Movie", you need to confirm that "TheMovieDb" is selected in the "Movie Image Getter" in the media library, as shown below:
Similarly, if the media library type is "TV Shows", you need to make sure that "TV Show Image Getter" is "TheMovieDb". Unlike "Movies", the TV show type also has "Season Image Getter" and "Episode Image Getter", and the selection method is the same.
Note 1: In fact, you don't have to choose "TheMovieDB" for "Image Getter", "FanArt" is also possible, and the domain name "fanart.tv" corresponding to "FanArt" does not seem to be polluted by DNS at present, and can be accessed directly, and the image quality and cleanliness are better than tmdb.
Note 2: If you use other similar plug-ins, the same principle applies. If it does not work properly, try to check whether the domain name that the plug-in needs to access can be resolved and accessed normally.
No science or magic environment
This should be the scenario for most of the friends who use emby in China. In this case, you need to solve the problem through the following two steps.
1. Obtain the correct resolution results of the relevant domain name
Because domestic DNS is not trustworthy, in order to obtain the correct resolution results of the above two domain names, you need a method that "does not rely on science or magic". Generally, it is solved through a foreign domain name query website that can be accessed normally. I will introduce two query URLs that can be used normally below (I don't include how long they can be used, and I have no say in this~).
Note: Most sites now use CDN technology, but they may use CDNs from different manufacturers (CloudFlare, Amazon, etc.). After using CDN (using IP anycast), due to the principle of proximity access, the IPs resolved from different locations are likely to be different, and the results of different DNS query URLs may also be different. The evaluation standard is that it can be used.
https://dnschecker.org/
According to the method in the above figure, the relevant domain name resolution results are as follows:
api.themoviedb.org. 60 IN A 13.226.225.44 api.themoviedb.org. 60 IN A 13.226.225.4 api.themoviedb.org. 60 IN A 13.226.225.73 api.themoviedb.org. tmdb.org. 29 IN CNAME tmdb-image-prod.b-cdn.net. tmdb-image-prod.b-cdn.net. 4 IN A 169.150.249.164
https://www.ipaddress.com/
According to the method in the above figure, the relevant domain name resolution results are as follows:
api IN A 52.85.151.18 api IN A 52.85.151.24 api IN A 52.85.151.28 api IN A 52.85.151.48 image IN A 185.93.1.243
There are many other similar DNS query websites or tools, you can research them on your own.
2. Configure the resolution of relevant domain names according to your own environment
Modify the hosts file on the host where the emby server is located
This should be the method adopted by most emby users. Depending on the system and deployment method installed on the host where the emby server is located (windows, linux, macos, docker, etc.), you need to modify the hosts file of the installation system using the corresponding method according to different installation systems. There are many related tutorials on the Internet, so I won’t go into details.
Note: Some devices have a protection mechanism for hosts files, such as QNAP. The modified hosts file will be restored to the default value every time the device is restarted. Therefore, if you modify the hosts file on such a device, you must modify the hosts file again after each restart or use a startup script to modify it automatically.
Setting up on your router
In addition to directly modifying the hosts file of the emby server host, you can also make relevant settings on the router. Taking the iQiyi router as an example, you can use the "DNS reverse proxy function":
Fill in the domain name to be resolved and the resolved IP address as shown in the figure below, and then save it.
Similarly, add image.tmdb.org. After the addition is completed, it will look like the following figure:
Note 1:
It is recommended to enable the DNS proxy server and force client DNS proxy functions when using this function.
In DNS cache mode, reverse proxy is effective; forced proxy mode is also effective;
If you only set the proxy mode and do not check the forced proxy, whether it is effective will be determined based on the user's DNS. When the client DNS is set to the gateway address, the reverse proxy is effective; when the client DNS is set to the correct DNS, it is not effective.
Note 2:
If it is an ASUS router or an openwrt router, you can achieve the same function by modifying the dnsmasq file.
Note 3:
It is possible that the IP addresses of the relevant domain name resolutions have changed (after all, these addresses are originally the IP addresses of the CDN provider). If you find that the tmdb plug-in is not scraping normally, you need to re-resolve the IP address and repeat the previous modification steps.
Note 4:
If at some point the domestic blockade of themoviedb is upgraded (in addition to polluting DNS, it also blocks IP or SNI), the above method will become ineffective, and we will have to rely on science or magic.
A scientific or magical environment
This scenario is very flexible: directly use foreign DNS servers, use a proxy on the host where the emby server is located, or directly use science or magic, etc. As long as you do not use domestic contaminated DNS servers, I will not go into details here.
In addition, if you use the deployment method mentioned in my other article (see article:Discussion on the best deployment scheme of soft router series iQuick+openwrt (goodbye, bypass router)), turn the bypass router into the gateway of another wan port of iKuai (such as wan2), and then you can use iKuai's domain name diversion method to achieve it more easily:
Export emby's film and television resource data
Sometimes, you may want to know which movies (or TV series) you have, as well as the key information of each movie (such as name, addition date, release date, type, rating, score, duration, re-encoding type, specific storage path, etc.). If you can export this information to a file, you don't need to log in to emby when needed, but can directly query this information in the local file. This requires the "Reports" plug-in.
First make sure the plugin is installed, then click the option in the lower right corner:
You can also enter it directly from the console advanced:
After entering, you can see the following interface. I will take the Movies type as an example:
All the contents you see here can be exported. You can select which columns to export on the right. All columns are checked by default. The export file format supports Excel and CSV. I will take the export of Excel (xls) file as an example:
Get an xls file, and after opening it, you can see the following content:
In addition to the common information about the movie, the Path on the far right also contains the specific storage path corresponding to the movie, which can help you quickly locate the location of the movie when needed.
Poster wall cover picture enhancement
The default emby media library poster wall looks like this:
The biggest problem with this is that you can't tell the resolution of the movie at a glance. What's more troublesome is that if the same movie has multiple resolution versions (for example, 1080p and 2160p) and they are not handled correctly (how to handle it correctly is discussed in the next section), the same movie with different resolution versions will be displayed on the poster wall with the same cover at the same time. You can't intuitively tell which one is 1080p and which one is 2160p from the poster wall. You can only click in to view the media information to distinguish them, which is very inconvenient.
The CoverArt plugin solves this problem:
After installing the plugin, the poster wall looks like this:
From the newly added logo in the red box above (Blu-ray is 1080p, 4K is 2160p), you can know the resolution of the movie at a glance, which is very convenient.
Note: CoverArt does not require special settings, the default settings are enough, and the logo will be automatically generated after installation. However, some cover image scraping plug-ins in the past would pull images with "Blu-ray Disc", which would result in the cover image having two layers of logos if CoverArt is installed, as shown below:
This will be very ugly, so to use CoverArt you need the cover image scraper to have a very clean image, which is why I recommended Fanart earlier. If you encounter this situation, just scrape it again.
How to save multiple versions of the same movie at the same time
As mentioned in the previous section, sometimes we may need to keep multiple versions of a movie at the same time (the resolutions of these multiple versions may be the same or different). For example, the movie "Eraser" has a 2160p TC version (theater version, 117 minutes long) and a 1080p DC version (director's cut, 145 minutes long). In this situation, if I have to choose between the two, it would be very difficult to decide. So as an adult, I don't make multiple-choice questions like children. I choose both!
However, if no special processing is done, no matter whether the two films are placed in the same folder or in different folders, they will eventually appear on the poster wall as two movies with the same cover (if CoverArt introduced in the previous section is not installed, you cannot directly distinguish which one is 1080p and which one is 2160p).
In fact, emby has a solution to this situation. Through a specific naming method, the following effects can be achieved:
In this way, only one movie will appear on the poster wall, but you can choose different versions to watch after entering.
To achieve this display effect, a specific naming method is required, as shown in the figure below:
Things to note are as follows:
1. The two videos need to be in the same folder.
2. The names of the two videos are composed of two parts (green frame and red frame): the part in the green frame needs to be exactly the same as the name of the folder; the red part is to identify different versions, which is composed of "-version" (note that there must be a space in front of -), in this case it is "-1080P.DC" and "-2160P.TC".
Non-feature content
In addition to the main film, we sometimes also download some other non-main film content, such as interviews, behind-the-scenes footage, trailers, etc. However, if these contents are placed directly together with the main film, Emby will directly identify it as a new movie, which is very difficult to handle. This forced me to give up these contents with great reluctance for a period of time (such as some photo album footage, which are actually still interesting).
However, emby actually has a corresponding solution. Just create a folder with a specific name under the corresponding movie folder, and then put the non-feature content directly in the newly created folder (nesting is not supported, and a new folder needs to be created for each type).
The naming convention for folders is as follows:
extras
: Additional media content filesspecials
: Special program or special editionshorts
: Short Filmsscenes
: Scenefeaturettes
: Specialbehind the scenes
: Behind the Scenesdeleted scenes
: Delete contentinterviews
: Interviewtrailers
: Trailer
Taking Furong Town as an example, including the highlights, the final effect is as follows:
Afterword
In fact, the basic operation of emby is not difficult. In my opinion, the difficulty lies in how to design a distributed architecture for storing film and television resources and the energy spent on regular organization and migration of newly downloaded resources.
Fortunately, hard disk capacities are getting bigger and bigger now. I have endured for 3 years, and the capacity of a single hard disk has increased from 14T to 22T. This time I bought 4 22T hard disks at one time. Although it made me heartbroken for a while, it also saved me from having to toss so frequently. I will try to endure for another 3 years this time to see how big the capacity of a single hard disk can be by then.
Now the four 22T hard disks have used more than 50%~~:
It's really useless.
I used to do this before, but later I found that I didn’t have such a strong obsession with the poster wall. Now I just put everything I download on the alist, haha
I don't actually have any obsession with the poster wall. It's mainly because I built an emby experience server specifically for this. When you enter a media library, it will go in circles for a long time, which must make people who come in to experience it feel bad, so I want to improve it as much as possible.