A function that is often found on TV recorders, such as "Watch recorded programs on your smartphone!" Panasonic's "Room Jump Link" or that area A function that allows you to play any video on the client terminal side by placing the video on the DLNA server.
** ◆ Environmental aspect ** OS : Ubuntu (20.04 64bit) DLNA function: MiniDLNA (focal, now 1.2.1 + dfsg-1build1 amd64)
** ◆ Direction ** Goal: You just need to see videos (mp4), music (mp3), images (jpg) The DLNA construction page on qiita is only roughly written for Raspberry Pi I wrote it because there seemed to be no complete article from the beginning to the end
Postscript: I was able to play from PS4
sudo apt update
sudo apt-get install -y minidlna
This time, I will create a folder called "dlna" directly under the root to store videos and so on. (If you are particular about the storage location, please change / replace it arbitrarily)
sudo mkdir -p /dlna/video
sudo mkdir -p /dlna/picture
sudo mkdir -p /dlna/audio
Edit "/etc/minidlna.conf" with an editor.
sudo vi /etc/minidlna.conf
There are three parts to edit. Since it is long to put all minidlna.conf on it, only the important points are extracted
** ・ Line 26 ** Change the storage folder for videos you want to distribute. The folder part of "media_dir = / var / lib / minidlna" in the last line Rewrite to the folder name (/ dlna / video) for storing the video that was created first. (Note that dlna will not recognize the video unless you put "V," in front of the folder path.) In addition, "P, / dlna / picture" for images and "A, / dlna / audio" for music will be added.
# Path to the directory you want scanned for media files.
#
# This option can be specified more than once if you want multiple directories
# scanned.
#
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
# * "A" for audio (eg. media_dir=A,/var/lib/minidlna/music)
# * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
# * "V" for video (eg. media_dir=V,/var/lib/minidlna/videos)
# * "PV" for pictures and video (eg. media_dir=PV,/var/lib/minidlna/digital_camera)
media_dir=/var/lib/minidlna
↓
media_dir=V,/dlna/video
media_dir=P,/dlna/picture
media_dir=A,/dlna/audio
```
** ・ Line 97 **
Automatically recognize new files added to each folder.
Just uncheck here.
```python
# Automatic discovery of new files in the media_dir directory.
#inotify=yes
↓
inotify=yes
```
** ・ Line 119 **
Interval to check if a new video has been added to the folder (unit: seconds)
This time, I want to update it once every 10 seconds, so I set it to "= 10". Time is your choice.
```python
# SSDP notify interval, in seconds.
# notify_interval=895
↓
notify_interval=10
```
** Save if you can change up to this point. ** **
# 3. Start MiniDLNA
Setting to automatically execute when the service is started and the PC is started
```
sudo systemctl start minidlna
sudo systemctl enable minidlna
```
* Even if you say the following, you don't have to worry because the automatic startup is set.
$ sudo systemctl enable minidlna
minidlna.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable minidlna
# 3. Operation check
Start the browser on the ubuntu desktop or a PC in the same network,
Access "http: // \ <dlna machine host name>: 8200" (Example: http: // hogehoge: 8200)
If the following screen appears, it's OK for the time being.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/594444/20827600-85c7-d493-b7b7-764c124f7e65.png)
If you can check the screen, stop MiniDLNA temporarily, delete the DB and start it.
For some reason, the additional files are not automatically recognized at first (problem with DB update?)
```
sudo systemctl stop minidlna
sudo rm /var/cache/minidlna/files.db
sudo systemctl start minidlna
```
When the service starts, store an appropriate file in each storage folder (/ dlna / video, etc.) and
Update the browser page with the F5 key etc.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/594444/d7630826-0979-bb5c-4fa2-446e6c57aa5a.png)
If the added video is recognized, the count of "Video files" should be increased by one.
Similarly, any file is stored in the image folder (/ dlna / picture) and the music folder (/ dlna / audio).
# 4. Playback of videos, etc.
From here on, use any DLNA client to access the DLNA server.
This time, as an example, play with [VLC for Android](https://play.google.com/store/apps/details?id=org.videolan.vlc&hl=ja&gl=US) on android terminal.
* Connect the client terminal to the same network as the built server.
For the smartphone version, tap "Browse" in the folder mark at the bottom of VLC and
You can see the DLNA server you built in the "Local Network" column.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/594444/93903a30-386f-6d8a-0ae7-ce282ead181b.png)
For tablet version, tap "Local network" from "3" on the upper left
You should see an icon similar to the one above.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/594444/5683f04a-196f-5787-cc8d-62b6ced4a9dd.png)
If you can connect to the DLNA server, go under the hierarchy of "video", "picture", "audio", etc. under "Brows Folders".
The stored file will appear, so if you can tap it to play it, the construction will be completed.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/594444/397af3a3-17e4-5f55-1498-e0f7007522de.png)
As an aside, I was able to view it from the PS4 "Media Player" (surprise)
Can it be used widely unexpectedly?
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/594444/02ea2b93-2c13-a271-91ee-34d4b8eab760.png)
Recommended Posts