Silent NAS as the center of a small audio-video multi-room system
This test system became the solution for the task of "making a three-zone multiroom for a reasonable price on quiet equipment."
Quiet equipment is a key concept. The apartment does not provide space for noisy devices.
Another wish was to use not a file folder, but a full-fledged media library for selecting films - TV shows - music. With the division of genres, artists, directors. And with a selection of works on posters - covers.
One zone (living room) required the highest possible quality of video and audio playback, the other two were not so critical to the formats of audio-video content.
I wanted to build the system from a minimum number of components, so a small fanless NAS with the functions of a media player - QNAP HS-251 was chosen.

The device does not differ in super performance of the disk subsystem, but it, as it turned out as a result of testing, is quite enough for such a task.
But there are almost any interfaces in it:

there are two HDMI connectors, but the second one cannot be used yet. It is intended, as far as I can understand, to work in future versions of firmware.
For the first zone (living room), the built-in XBMC / Kodi player, known for its "omnivorous", was used. Its latest versions manage to play even exclusively “crookedly” prepared video.
The HDMI cable from the NAS was plugged into the receiver, from the receiver into the TV.
On the NAS, Kodi autologin and autostart were selected.
And the remote control for Kodi is activated so that IP commands can be sent.
Control commands to the TV, receiver and NAS were sent from universal remotes and tablets via the Savant system.
If desired, it is possible without it, only the remote controls will need to be juggled a bit.
On the TV screen we get a picture familiar to everyone who had dealings with the XBMC player:

In the process of playing FullHD movies from files of 20-30 gigabytes, no noticeable load on the processor was created.

In the player’s settings it was set to “skip all audio and video formats to the output without transcoding”. With audio streams of various types, up to the DTS Master, the receiver was successfully dealt with.
The task remains to play content from the NAS on two other TVs. Nobody had hoped for built-in players (TVs were not the newest), so the question arose of choosing external media players.
Apple TV was selected. Mainly due to the good possibilities of working with media directories. Nobody wanted to select films by file names, looking for them in folders.
There has long been a known way to “feed” Apple TV content from local storage. And this name is Plex / PlexConnect.
First, Plex Server was installed on the NAS. But not from the QNAP repository (often the latest version is there), but from plex.tv/downloads
The next step is to install Python. Its version 2.7 lies in the QNAP repository. Python is needed for PlexConnect to work, which works as a gateway between Plex Server and Apple TV.
Finally, the most interesting procedure comes — installing PlexConnect.
It needs a free port 80 to work. For this port, Apple TV starts communicating with PlexConnect, “thinking” that it is an Apple server. Port 80 is by default occupied by the built-in NAS web server. You can either disable it or move it to another port. This is a separate web server, and not an administrative web-based NAS management interface.
If everything went well, you can copy the folder with PlexConnect scripts to the NAS, and then go through SSH to the Linux command line on the NAS, get to the folder where PlexConnect was placed, and generate security certificates.
You can generate certificates in the PlexConnect / assets / certificates directory with the following commands:
openssl req -new -nodes -newkey rsa: 2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj "/ C = US / CN = trailers .apple.com ”
openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem
And finally try to run PlexConnect manually:
python PlexConnect.py You
may need to specify a script path PlexConnect There
can be two results - either it will work or not.
If it works, the system will wait for calls from Apple TV, process them, and either give information on the state of the media library, or receive commands to play files, or send requests to Apple servers.
And if it does not work, then you will receive a message that it did not work out.
Most often it will be either “no certificates” - if you forgot to generate them, or “port 80 is busy”.
The last message is the most unpleasant. You need to understand what kind of service this port occupies and turn off this service. The simplest thing is if you forget to disable the web server on the NAS. Worse if it is already disabled, and the port is still busy.
As found on forums.plex.tv, the Qthttpd process is most often run.
Why does it still run on some NAS models, when the web server is turned off, I have no answer.
If you kill it manually with the
killall Qthttpd command,
it most often restarts automatically after a minute or two.
It is important that PlexConnect starts up before this process restarts.
I did not find any pattern on which NAS models this problem manifests itself, but it happens.
The solution may be to use the script for the PlexConnect auto start, written by the participants of the plex.tv forum:
*********************** autorun.sh ******** ***************************************
#! / bin / sh
killall Qthttpd
/ usr / bin / python /root/Library/PlexConnect/PlexConnect.py -d
***************************************************** ****************************
It is clear that the paths to the files must be set.
In order for Apple TV to start working with Plex, it must be configured by specifying the NAS address as the DNS server:
Settings-> Network-> Ethernet (if the Apple TV works via Ethernet) -> DNS (manually)
The next step is to install a security certificate. This is done directly from the Apple TV, without involving any third-party software:
Settings-> General-> Send data to Apple (Setup / General / Send Data to Apple)
Here should be "NO"
Next, highlighting this option using the "native »Remote control, press the Play button (not a choice, namely Play).
Apple TV suggest creating a new profile. We agree and indicate the following URL
trailers.apple.com/trailers.cer
After that, Apple TV will be able to establish a secure connection with our Plex Server.
Plex has restrictions on the playback of multi-channel audio. As the forums say, no DTS from MP4 / MKV files, and no DD from MKV.
If everything went well, then after selecting the Trailers section, you will be taken to the screen for selecting materials (films, series, music, etc.). It is clear that before that Plex Server itself needs to be told what you have and where it lies:

Although the setup procedure does not look very simple, it is performed only once, after which Plex itself disassembles the files that you upload to the appropriate folders.
You can download media files in any way possible, including using the synchronization function between NAS (if you have more than one NAS, and you want the content to be synchronized everywhere), or using the built-in torrent client.
TV show selection screen with Apple TV.

Screen for selecting a movie by genre.

Plex / PlexConnect transcodes video on the fly. But such transcoding seriously loads the NAS processor. For the HS-251, do not transcode files with a resolution greater than 720p.
And at the same time, the load on the NAS processor is pretty good:

For testing, I started transcoding through Plex on the significantly more powerful QNAP TS-870. Even he was not easy, although everything worked:

Possible problems:
- if the name of the film is transliterated (Russian words in English), the film will not be recognized. Apple TV will show it as a rectangle with a picture from the movie and a caption - the name of the file. You can edit the signature and insert a picture through Plex Server, but it’s more convenient to give the name in English.
- Audio tracks are not always played correctly. In some cases, incorrect file encoding instead of the Russian track is English, although the file has both. In my case, this is not a problem, but some are straining :-)
- sometimes when you turn on the Apple TV, it displays a message that it is not connected to the Internet. You need to go to the Apple TV start page, and then return to the Trailers section.
conclusions
For me, this is a solution with a minimum degree of "homemade". Ready-made silent NAS, ready-made Apple TV. Included. configured, it works.
There are limitations, but, as programmers say, "this is not a bug, this is a feature."
Is it possible to solve the problem cheaper - is it possible if you assemble everything yourself. Will it turn out just as elegantly and reliably - I doubt it.
Sakharov Alexander
Quiet equipment is a key concept. The apartment does not provide space for noisy devices.
Another wish was to use not a file folder, but a full-fledged media library for selecting films - TV shows - music. With the division of genres, artists, directors. And with a selection of works on posters - covers.
One zone (living room) required the highest possible quality of video and audio playback, the other two were not so critical to the formats of audio-video content.
I wanted to build the system from a minimum number of components, so a small fanless NAS with the functions of a media player - QNAP HS-251 was chosen.

The device does not differ in super performance of the disk subsystem, but it, as it turned out as a result of testing, is quite enough for such a task.
But there are almost any interfaces in it:

there are two HDMI connectors, but the second one cannot be used yet. It is intended, as far as I can understand, to work in future versions of firmware.
For the first zone (living room), the built-in XBMC / Kodi player, known for its "omnivorous", was used. Its latest versions manage to play even exclusively “crookedly” prepared video.
The HDMI cable from the NAS was plugged into the receiver, from the receiver into the TV.
On the NAS, Kodi autologin and autostart were selected.
And the remote control for Kodi is activated so that IP commands can be sent.
Control commands to the TV, receiver and NAS were sent from universal remotes and tablets via the Savant system.
If desired, it is possible without it, only the remote controls will need to be juggled a bit.
On the TV screen we get a picture familiar to everyone who had dealings with the XBMC player:

In the process of playing FullHD movies from files of 20-30 gigabytes, no noticeable load on the processor was created.

In the player’s settings it was set to “skip all audio and video formats to the output without transcoding”. With audio streams of various types, up to the DTS Master, the receiver was successfully dealt with.
The task remains to play content from the NAS on two other TVs. Nobody had hoped for built-in players (TVs were not the newest), so the question arose of choosing external media players.
Apple TV was selected. Mainly due to the good possibilities of working with media directories. Nobody wanted to select films by file names, looking for them in folders.
There has long been a known way to “feed” Apple TV content from local storage. And this name is Plex / PlexConnect.
First, Plex Server was installed on the NAS. But not from the QNAP repository (often the latest version is there), but from plex.tv/downloads
The next step is to install Python. Its version 2.7 lies in the QNAP repository. Python is needed for PlexConnect to work, which works as a gateway between Plex Server and Apple TV.
Finally, the most interesting procedure comes — installing PlexConnect.
It needs a free port 80 to work. For this port, Apple TV starts communicating with PlexConnect, “thinking” that it is an Apple server. Port 80 is by default occupied by the built-in NAS web server. You can either disable it or move it to another port. This is a separate web server, and not an administrative web-based NAS management interface.
If everything went well, you can copy the folder with PlexConnect scripts to the NAS, and then go through SSH to the Linux command line on the NAS, get to the folder where PlexConnect was placed, and generate security certificates.
You can generate certificates in the PlexConnect / assets / certificates directory with the following commands:
openssl req -new -nodes -newkey rsa: 2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj "/ C = US / CN = trailers .apple.com ”
openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem
And finally try to run PlexConnect manually:
python PlexConnect.py You
may need to specify a script path PlexConnect There
can be two results - either it will work or not.
If it works, the system will wait for calls from Apple TV, process them, and either give information on the state of the media library, or receive commands to play files, or send requests to Apple servers.
And if it does not work, then you will receive a message that it did not work out.
Most often it will be either “no certificates” - if you forgot to generate them, or “port 80 is busy”.
The last message is the most unpleasant. You need to understand what kind of service this port occupies and turn off this service. The simplest thing is if you forget to disable the web server on the NAS. Worse if it is already disabled, and the port is still busy.
As found on forums.plex.tv, the Qthttpd process is most often run.
Why does it still run on some NAS models, when the web server is turned off, I have no answer.
If you kill it manually with the
killall Qthttpd command,
it most often restarts automatically after a minute or two.
It is important that PlexConnect starts up before this process restarts.
I did not find any pattern on which NAS models this problem manifests itself, but it happens.
The solution may be to use the script for the PlexConnect auto start, written by the participants of the plex.tv forum:
*********************** autorun.sh ******** ***************************************
#! / bin / sh
killall Qthttpd
/ usr / bin / python /root/Library/PlexConnect/PlexConnect.py -d
***************************************************** ****************************
It is clear that the paths to the files must be set.
In order for Apple TV to start working with Plex, it must be configured by specifying the NAS address as the DNS server:
Settings-> Network-> Ethernet (if the Apple TV works via Ethernet) -> DNS (manually)
The next step is to install a security certificate. This is done directly from the Apple TV, without involving any third-party software:
Settings-> General-> Send data to Apple (Setup / General / Send Data to Apple)
Here should be "NO"
Next, highlighting this option using the "native »Remote control, press the Play button (not a choice, namely Play).
Apple TV suggest creating a new profile. We agree and indicate the following URL
trailers.apple.com/trailers.cer
After that, Apple TV will be able to establish a secure connection with our Plex Server.
Plex has restrictions on the playback of multi-channel audio. As the forums say, no DTS from MP4 / MKV files, and no DD from MKV.
If everything went well, then after selecting the Trailers section, you will be taken to the screen for selecting materials (films, series, music, etc.). It is clear that before that Plex Server itself needs to be told what you have and where it lies:

Although the setup procedure does not look very simple, it is performed only once, after which Plex itself disassembles the files that you upload to the appropriate folders.
You can download media files in any way possible, including using the synchronization function between NAS (if you have more than one NAS, and you want the content to be synchronized everywhere), or using the built-in torrent client.
TV show selection screen with Apple TV.

Screen for selecting a movie by genre.

Plex / PlexConnect transcodes video on the fly. But such transcoding seriously loads the NAS processor. For the HS-251, do not transcode files with a resolution greater than 720p.
And at the same time, the load on the NAS processor is pretty good:

For testing, I started transcoding through Plex on the significantly more powerful QNAP TS-870. Even he was not easy, although everything worked:

Possible problems:
- if the name of the film is transliterated (Russian words in English), the film will not be recognized. Apple TV will show it as a rectangle with a picture from the movie and a caption - the name of the file. You can edit the signature and insert a picture through Plex Server, but it’s more convenient to give the name in English.
- Audio tracks are not always played correctly. In some cases, incorrect file encoding instead of the Russian track is English, although the file has both. In my case, this is not a problem, but some are straining :-)
- sometimes when you turn on the Apple TV, it displays a message that it is not connected to the Internet. You need to go to the Apple TV start page, and then return to the Trailers section.
conclusions
For me, this is a solution with a minimum degree of "homemade". Ready-made silent NAS, ready-made Apple TV. Included. configured, it works.
There are limitations, but, as programmers say, "this is not a bug, this is a feature."
Is it possible to solve the problem cheaper - is it possible if you assemble everything yourself. Will it turn out just as elegantly and reliably - I doubt it.
Sakharov Alexander