[Mil MYC-J1028X development board trial] Build a DLNA streaming media server
[Copy link]
In the previous article, I shared how to use Transmission to build a PT high-speed download server, which can be used to download media resources.
After successfully downloading the media resources, we also need to provide the media resources to other devices so that other devices can browse and play them. Otherwise, there is no point in downloading them.
To provide media resources to the outside world on the Mir MYC-J1028X development board system, you can use Samba or DLNA.
Samba is used to establish file sharing like network neighbors, while DLNA is specifically used to publish media resources to the outside world.
In this article, we will share how to build a DLNA media server on the Mir MYC-J1028X development board system and publish resources to the outside world.
1. Set the wired network card to start automatically:
In the previous article, we briefly talked about enabling the wired network card, but after restarting, it needs to be activated again.
Then, let's do some processing first so that the wired network card can be automatically activated after the system restarts:
[For some reason, the following code is invalid in markdown code mode, and it is a smart map]
After the operation is completed, you can see the following information:
The green active (running) means the status is normal and running.
Then, we can use nmcli to manage the network:
sudo nmcli connection add con-name "my connection" type ethernet ifname eno0 autoconnect yes ipv4.method auto
The above statement means that the wired network card eno0 is automatically turned on and automatically obtains an IP address.
After the operation, check the network status through the following command:
As can be seen from the above picture, the corresponding wired network card eno0 has been successfully set up.
You can also set up other wired network cards in the same way.
Now, you can try sudo reboot to see if the wired network card starts automatically.
2. Prepare the media file directory
The eMMC space of the Mir MYC-J1028X development board is not large, so do not download media files on it.
We can plug in a USB mobile hard disk or a large-capacity SD card. In my demonstration, I used an SD card.
First, on other computers, format the SD card as exFAT, and then copy the media files to the Movie directory in the root directory of the SD card in advance.
Then, insert the SD card into the slot under the heat sink on the development board, and then use the following command to mount it:
View the device: lsblk
Among them, mmcblk0 represents our SD card
Storage device view: sudo fdisk -l
Among them, /dev/mmcblk0p1 indicates the partition we just formatted and can be used later.
Then, mount it:
sudo apt-get install exfat-fuse exfat-utils
sudo mkdir /sdcard
sudo mount.exfat -o pagecode=936,iocharset=cp936 /dev/mmcblk0p1 /sdcard
df -h
Now, the SD card is mounted successfully and can be used normally.
One thing to remind you is that in the mount command, -o pagecode=936,iocharset=cp936 can ensure that Chinese file names are displayed correctly, because it corresponds to the default file name encoding in the Chinese environment under the Windows system.
If you have copied the media files to the Movie directory of the SD card in advance, you can check them now:
When downloading media resources in Transmission, you can set the storage path to the following directory:
3. Install DLNA service:
The next step is to install the DLNA server.
I chose minidlna, which is a very small DLNA server software with very good functions.
Installation is also very simple:
sudo apt-get install minidlna
Then set it up:
sudo vim /etc/minidlna.conf
#Configure media file directory
media_dir=/sdcard/Movie
# Service port 8200
port=8200
# Automatically refresh the media file directory with new files
inotify=yes
# The DLNA service name presented to the outside world is
friendly_name=MYIR_DEVICE
You can comment out the original corresponding items in the configuration file /etc/minidlna.conf, and add the above items at the end to facilitate unified management.
After the configuration is complete, restart minidlna and check the status:
sudo /etc/init.d/minidlna force-reload
sudo /etc/init.d/minidlna status
Now that the DLNA server has been successfully run, we can perform a playback test.
4. Play DLNA media resources
To play DLNA media resources, you can use your mobile phone, Android TV, or computer.
On a computer, VLC is usually used, which can be downloaded from: VLC: Official Website - The free multimedia solution for all platforms! - VideoLAN .
After downloading, open the VLC player software and browse UPnP to see the media resources published by the DLNA server:
Click the corresponding media file to play it:
Thanks to the high performance and Gigabit Ethernet port of the Mir MYC-J1028X development board, external resource release is efficient and fast.
Playback is very smooth and the drag progress is very fast.
Just like that, a home streaming media server was successfully built.
Hurry up and get a large mobile hard drive, then you can download as much as you want and enjoy watching it!!!
|