MiniDLNA - server setup, installation tips, configuration

The Digital Living Network Alliance is an association of electronic and computer manufacturers that has created a compatible standard for all of its systems. DLNA allows you to connect different devices on the same network to share different content, including MiniDLNA setup. The advantage he can offer is simple configuration and versatility. The system can work both in Wi-Fi networks and in Ethernet networks.

Minidlna customization

Users are offered a fully automated solution consisting of software called MiniDLNA. It allows you to exchange folders and do everything that is visible to computers on the network. This program is free and works on Linux. Before configuring the MiniDLNA DLNA Linux server, make sure Wi-Fi supports this service.

Minidlna.conf reads configuration parameters from the system-wide configuration file /etc/minidlna.conf or the file specified by the '–f' option on the command line. It contains pairs of keyword arguments, one on each line. Lines beginning with '#' are empty and are interpreted as comments in the minissdpd MiniDLNA settings.

DLNA Digital Standard

DLNA Digital Standard

The Digital Living Network Alliance is the digital standard for home digital, converged, networking devices. DLNA devices are compatible with each other, that is, DLNA ensures that media servers, media players, computers and mobile phones understand each other.

ReadyMedia (formerly MiniDLNA) provides a DLNA server. Each Linux computer becomes a media server for image, video, audiobooks and other digital devices that support DLNA and connect to a home network. DLNA / UPnP devices automatically detect the media server. The content of the media server is displayed on the devices and can be extracted from there in the form of a stream.

If the user home directory serves as a source for multimedia files, the settings and rights of MiniDLNA must be set so as not to bind to a specific IP address. MiniDLNA does not recognize files on the second hard drive. Throughout the entire use path, including media, the root user must be replaced with the current mode.

If the user has a decent size music library, they will configure MiniDLNA on OpenWrt. The solution is to create a minidlna database on a Linux PC:

  1. Create a directory on the OpenWrt hard drive or flash drive to store mini-log files and .mkdir / PathToHardDrive / minidlna database files.
  2. On an OpenWrt device, the following lines / etc / config / minidlna are modified to place the Minidlna database and log file on the hard drive or flash drive connected to the device.
  3. This method was tested with the device when setting up MiniDLNA on OpenWrt with 32 MB of RAM and a music library of more than 11,000 songs. And you can also add swap if the system has little memory.
  4. Windows Notepad cannot save UNIX-encoded data; Notepad ++ is used instead.
  5. You can directly edit them on the router via ssh or telnet using vi or nano, both are included in the firmware. These two operators will create files already encoded in the correct format.
  6. For Windows users, the quick option is to run nano via telnet or ssh, then simply copy and paste the contents of the desired file into the nano window and save it in the MiniDLNA database directory.

ReadyMedia Server Software

ReadyMedia Server Software

ReadyMedia, formerly called MiniDLNA, is the server software for DLNA / UPnP clients and supports all multimedia files, for example, applications such as Totem and Kodi, as well as devices - portable media players, smartphones, televisions, gaming systems, PS3 and Xbox 360. If you need to use an unofficial branch that supports transcoding, install the readmedia-transcode-gitAUR package.

By default, it works as a system service. It is configured in /etc/minidlna.conf. By default, the MiniDLNA configuration in Debian works as the user minidlna, which can be changed using the user line /etc/minidlna.conf and also change the db_dir and log_dir parameters in directories that can be set by the user.

The service is managed with minidlna.service using the systemd command. The kernel adds one inotify view to each folder or subfolder in the directories set by /etc/minidlna.conf to monitor changes, which allows you to update Media_DB in real time.

When the software starts as a standard user, it does not have the ability to change the input limits of inotify. If, by default, the number of inotify hours is not sufficient to control all media folders, increase the inotifysysctl number of hours, for example, to 100000, which should be sufficient for most applications:

# sysctl fs.inotify.max_user_watches = 100000.

Inotify performance may vary by device type. Some of them do not scan media drives on an ongoing basis. If you delete MiniDLNA files from controlled media directories, they may not be fixed until the DLNA client of the device is restarted.

And you can also manually clear or rebuild the DB MiniDLNA after stopping the MiniDLNA daemon or analyze its debug output:

  1. Press the Ctrl + C keys simultaneously to exit.
  2. To rebuild Media_DB forcibly: # minidlnad -R.
  3. To run in debug mode: # minidlnad –d.

File system and localization

File system and localization

By storing MiniDLNA Media_DB on an external drive, available in both Linux and Windows, they select the correct file system for it. NTFS saves its Linux by default on Windows:

  1. Rw-access for the root user and UTF8 font encoding for file names, so media names will be read when viewing Media_DB in the terminal and media player, since most support UTF8.
  2. If the user prefers Vfat (FAT32) for better compatibility with a USB drive, when connected directly to Media_Collection, the Vfat drive has the names of folders and files in the local language, MiniDLNA can transcode them to UTF8 while scanning folders in Media_DB.
  3. Add settings for mounting the FS language code page to Media_Collection and Media_DB for transcoding into short DOS file names to convert long names to a terminal locale.
  4. Set rw permissions for all users, since Vfat does not retain Debian permissions in MiniDLNA setup.

Iocharset is present in a system with the appropriate locale if the terminal or player supports only short file names, therefore they check whether the installed code page is present and included, that is, it was included in the system configuration when the ArchLinux release was compiled or the possibility of recompiling the release was considered to add it: ls / usr / share / fonts / encodings.

The MiniDLNA installation lists movies and photos by file name in its database and records music by ID3 tags instead of native names. If the music collection was not marked in UTF8, then in local encoding, MiniDLNA may not identify and transcodes it correctly in UTF8 for display in the media player. The original tag code page may not be available on the system, so the tags will not be readable, even if the media file names are. In this case, consider re-tagging the collection in UTF-16BE or UTF-8 encoding using the ID3 tag converter.

Choosing the “right” file system for Media_Collection is a compromise: XFS and EXT4 show fast read and write for HD disks and critical processor load for small Plug-in computers with attached storage. NTFS is most compatible with Windows when connecting a drive directly for faster copying, while network file systems such as Samba, NFS or iSCSI allow you to import any Linux FS with a slower copy of data into Windows. Because file fragmentation affects playback, movies are stored on a non-system drive formatted in XFS, NTFS or EXT4 and avoid EXT3 and less stable FAT32.

The file named minidlna.conf.base, created in the minidlna database directory, has several parameters for further setting up the media server. Since it is provided in the firmware and is a standard Linux distribution, you can find the help pages that describe the available options by simply running, for example, man minidlna for it, and get a lot of interesting answers.

Multimedia processing

Multimedia processing

MiniDLNA is designed for small devices, so it does not generate movie thumbnails to reduce CPU load and database build time. It uses in the same folder with the movie, if any, or extracts them where they are from media containers such as MP4 or MKV, with built-in Album Art tags, but not with AVI.

You can add JPG icons of 160x160 pxl or less by configuring MiniDLNA folders using the Thumbnail Maker, and miniDLNA will associate them with media files after rescanning. Large icons will be resized and saved in Media_DB, which slows down scanning.

For several episodes of the show in the folder, each name must match the name of the episode without ext, for example, <file> .cover.jpg or <file> .jpg. When viewing photos, progressive lossless compression of JPGs may not be supported by the DLNA player. Therefore, they resize photos to the “suggested photo size” in the player’s documents for a free image slide show.

The DLNA specification limits the type of JPG or PNG image and the maximum size to 4096 x 4096 pixels - and this means that the DLNA implementation supports the LARGE format. The next lower limit for MEDIUM size is 1024 x 768, so resizing the image can help display photos correctly.

To reduce the load on the system, MiniDLNA does not recode “incompatible” multimedia files on the fly, supported by the player formats. When creating Media_DB, it may incorrectly determine whether certain formats are supported by the player, which can play a wider selection of formats through UPnP.

Starting Media Server and installing the OS

Starting Media Server and installing the OS

Launching a media server using MiniDLNA allows you to transfer photos, videos and music to the network. In order to perform customization using raspberry pi as an example, you will need:

  1. Another computer if you need to use SSH.
  2. Hard drive with media SD card for raspberry pi operating system.
  3. Raspberry pi wifi dongle.
  4. Power supply for raspberry pi (minimum 1 AMP and 5 volts for model B raspberry Pi).
  5. Power USB hub.

Sequencing:

  1. Update and install SSH on a raspberry pi using the following commands: sudo apt-get update and sudo apt-get upgrade.
  2. Once this is completed, install the software, after which the user disappears to the MiniDLNA server.
  3. Use the following command to start the process: sudo apt-get install minidlna.
  4. After entering this command, the update procedure will be performed.

HDD connection

HDD connection

You must first have the media hard drive installed at startup. To do this, make sure that it is connected to a USB hub with power, otherwise it may cause installation problems. After this is done, return to the SSH client that is being used and enter: sudo fdisk –l.

Before starting MiniDLNA, you will need to find out the name of the disk and its format so that the media drive is mounted at startup and the user can access its contents. To do this, you will need to create the installation folder using the following command: sudo mkdir / media / HDD.

This command creates a folder with the name HDD in the media directory, after which you need to give it read permissions using the following command:

sudo chmod 777 / media / HDD.

This command line tells the HDD folder that it has all permissions, which means that it has read and write permissions that the user needs. Then they edit the MiniDLNA fstab configuration file and put the media disk into this file using the command:

sudo nano / etc / fstab.

To control the user, you need to use the arrow keys to navigate, go to the end, and add this line: / dev / sda1 / media / HDD vfat by default 0, 2.

In the first part, / dev / sda1 is the name of the hard drive to be added, in this case it is fat32. Finally, 0 and 2 at the end are permissions. Now go to the / media / hard drive: cd / media / HDD directory and run the command: Ls.

Setting up and editing a configuration file

To start configuring MiniDLNA, you need to edit the configuration file. This can be done using the following command: sudo nano /etc/minidlna.conf. After opening, you will need to change the part that looks like below.

Setting up and editing a configuration file

Then press the control button X to exit, and Y, if necessary to save to the clipboard, and then press enter to confirm. Now that MiniDLNA is configured, the program is updated. To do this, run the following command:

sudo service minidlna restartsudo service minidlna force-reload.

Now you can see the server on a Windows computer or any Upnp compatible device. Click on start, then on the left side of the screen click on the network, you can find the MiniDLNA server under the name in the media device section.

Ubuntu Software Specialization

Ubuntu Software Specialization

DLNA allows you to play home network media on all compatible devices. To install MiniDLNA, download it on sourceforge.net, enter the downloaded program folder and download a file with the name minidlna _...._ static.tar.gz.

Next, the steps are sequentially performed:

  1. Add stedy-minidna repository.
  2. Perform an update. My MiniDLNA runs on a server running Webmin. This module offers an easy way to edit the configuration file, reboot and rescan.
  3. Extract the downloaded file: tar -zxvf filename.tar.gz. This leads to the files: minidlna.conf and in the / usr / share folder.
  4. To configure the MiniDLNA Ubuntu, do the following: simultaneously press CTRL + ALT + T to open the OS terminal.
  5. It introduces: sudo apt-get install minidlna.
  6. After pressing ENTER, enter the password and, if necessary, enter S to confirm.
  7. Next, edit the MiniDLNA file, so enter: /etc/minidlna.conf.
  8. When configuring MiniDLNA Ubuntu, the file must be opened in the terminal, to run through the lines using the arrow keys.
  9. Next, delete comments and edit some lines: / PATH / DOS / FILES.
  10. When done, press CTRL + O to save the file.
  11. Now you need to change the other by entering the following: sudo nano / etc / default / minidlna.
  12. The same case of the previous file, only modify the following: # USER = minidlna = USER = "root".
  13. After editing, press CTRL + O to save it.
  14. Next, restart MiniDLNA and load the library.

Now the user can use any DLNA client to navigate between videos, such as Smart TV, Bluray, Smartphones.

Server Location on Windows 10

Server Location on Windows 10

Windows 10 packs a dozen high-quality entertainment tools, but few use them because most people don’t even know that they exist. However, it’s easy to turn your Windows 10 PC into a cool DLNA, without having to download and install third-party applications to access this service. Windows 10 has an integrated server with which you can access this service. Many streaming TV-connected devices, including the PlayStation 4, X-Box One, X-Box-360, and ROKU, support DLNA streaming.

They can transfer music and video files over the network from a PC if DLNA is installed. DLNA-compatible smartphones can also be used to mirror media content from a phone to an HDTV. Therefore, if the smartphone has interesting DLNA-compatible videos, and you need to watch them on the big screen, you can use the DLNA or Wi-Fi Direct function on the device. When using this method, the smartphone works like a remote control.

To enable software in Windows 10:

  1. Open PU and find "Media". You can use the search option or run Cortana and then search for Media. The “Network and Sharing” option will appear at the top.
  2. Click on the link "Streaming Media Settings" located right below the center of the network and the function "Enable Streaming Media" to activate the media stream server.
  3. Configure a streaming service that is Windows compatible with DLNA.

In general, the process should not take more than 5 minutes.

Access media from an Android device

Access media from an Android device

Using the MiniDLNA app, you can turn any Linux machine into DLNA in minutes. Since MiniDLNA is available in the official software repositories of both distributions, the installation is to run the install command as root. Once the package is installed, open the minidlna.conf configuration file in a text editor, running as root. At least two things need to be pointed out: paths to directories containing digital media, and the descriptive name DLNA.

Then create a database. To do this, stop: /etc/init.d/minidlna stop, then execute the following command as root: minidlna –R.

Start from the server using /etc/init.d/minidlna as root. Unfortunately, the team cannot update the database automatically, so you need to do this manually every time you add new media files. To access digital media served by a DLNA server, you must either have a DLNA-enabled device or install DLNA client software. When setting up MiniDLNA Linux Mint, you can try eezUPnP, while the AnDLNA application can come in handy for accessing media files from an Android device.

Troubleshoot service startup

Sometimes the mini-domain does not start at boot or MiniDLNA does not see the files. As an alternative to the system service, you can run the "min-line" as your own user. This can be useful if you need to share multimedia when the user does not have administrator access to the machine. In this case, create the necessary files and directories locally and edit the configuration, as described below.

Troubleshoot service startup

When using a firewall, you will need to open the ssdp (1900 / udp) and trivnet1 (8200 / tcp) ports. For example, this can be done using the iptables arno firewall, by editing firewall.conf, open the ports by doing: OPEN_TCP = "8200" OPEN_UDP = "1900".

In some network configurations, MiniDLNA is connected to the router via the Internet, and there may be problems with access to Wi-Fi and the router. To solve this problem, make sure that the Multicast Isolation feature is disabled on the router. For example, connect to the configuration page, then Settings-> Bridge and VLAN-> Bridge List-> click Edit on Bridge Ethernet WiFi-> set Multicast Isolation to No-> Apply.

Note that in the systemd service, the ProtectHome = on parameter is used by default. If the user is going to share files located in the / home / system, he can reduce this restriction by updating systemd to override the device:

/etc/systemd/system/minidlna.service.d/override.conf.

The DLNA server may no longer be visible after a while when sharing on a bridge device. If ReadyMedia is used to “broadcast” on a bridge device, such as an OpenVPN device connected to an Ethernet device, the server may not be accepted by clients after a while, which can vary from a few seconds to noon. To solve this problem, you need to disable the "multicast promotion" with the following command:

# echo 0 >> / sys / devices / virtual / net / br0 / bridge / multicast_snooping.

This should make the server visible to clients, but the changes will be lost upon reboot. If this works, you can make the change permanent using the systemd utility file by editing / etc / systemd / system / multicas_snooping. This approach should disable multicast_snooping at every boot.

Source: https://habr.com/ru/post/K4407/


All Articles