This guide will show you how to create a personal media streaming server with Raspberry PI and Emby.
We’ll use also an USB device to collect our media files to be streamed. This device will be simply a flash disk in my test, but the procedure is the same for an USD Drive. An alternative option could be using a NAS. To have a working configuration, we’ll erase the USB disk, to take care to have an empty one or you could loose all existing data inside it.
What Is Emby
As described on its official website, Emby aims to bring together personal videos, music, photos and live television.
It is installed as a server, and can be accessed from app or web browser. It also allows to stream your media to DLNA devices or Chromecast to simplify connection. Emby is also compatible with a number of apps.
It has also a parental control, so that you can easily control what your children are watching and filter content. It can be installed on many platforms.
What We Need
As usual, I suggest adding from now to your favourite ecommerce shopping chart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continuing with the project or removing them from shopping chart. So, hardware will be only:
- Raspberry PI (including proper power supply or using a smartphone micro usb charger with at least 3A)
- micro SD card (at least 16 GB, at least class 10)
- USB FLash Drive
Check hardware prices with following links:
Steb By Step Guide
Prepare OS environment
Enable USB Mount at boot
We’ll use an USB drive to write data. So, we need to be sure that at every boot the USB Disk will be ready, without struggling on mounting it from terminal. For this purpose, I’ll use USBmount. Type on terminal:
sudo apt install usbmount
To be sure it will works, we need to change the line PrivateMounts=yes to PrivateMounts=no in “/lib/systemd/system/systemd-udevd.service”. Type
sudo nano /lib/systemd/system/systemd-udevd.service
and change the line (should be on line 27). If we want to make USB drive writable from users (not only from root), we need to edit usbmount.conf:
sudo nano /etc/usbmount/usbmount.conf
identify “FS_MOUNTOPTIONS” and edit it as follow:
- vfat is the filesystem
- umask=0000 is the permission of the file and folder. 0000 means rwx-rwx-rwx
Reboot the Raspberry PI and plug in your UDB Disk. Now, the simple command “mount” should list the following line within the other mounted devices:
/dev/sda on /media/usb0 type vfat (rw,nodev,noexec,noatime,nodiratime,sync,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
Prepare Your USB Device
I experienced some issues formatting my USB disk in FAT32. The only way I found to have a working installation was to format in ext4 the flash disk. Be aware: this operation will erase ALL your data in your USB disk.
According with an askUbuntu guide (https://askubuntu.com/questions/22381/how-to-format-a-usb-flash-drive), identify the USB drive among all storage partitions and volumes on your computer use:
You can also use:
Suppose it may be /dev/sda. Unmount it with:
sudo umount /dev/sda
To format drive with the ext4 file system format:
sudo mkfs.ext4 /dev/sda
Reboot to have it mounted and ready to be used for our docker volumes.
NOTE: in next section I’ll assume that your USB Disk is the only disk plugged on RPI. This should assure that at the boot it will be mounted on “/media/usb0”.
Install Emby with Docker
Installing Emby Server via Docker is simple and fast. The only thing to care is in downloading the right package, built for Armv7.
docker run -d --name emby-server --restart unless-stopped \ -v /media/usb0/config:/config \ -v /media/usb0/share1:/mnt/share1 \ -p 8096:8096 \ -p 8920:8920 \ -p 1900:1900/udp \ emby/embyserver_arm32v7:latest
At this point, you should be able to access in your favourite web browser with the address http://<<YOUR_RPI_IP_ADDRESS>>:8096
The first page, lets you choose the preferred language. Select and press Next:
The following page asks the first user and its password. Compile and press next. NOTE: if you have an Emby account, here you can specify it.
It’s time to specify media folders:
Remember that here you’ll map paths as seen inside Docker container, independently from host mount. So, the share folder upon configured will be available on /mnt/share1 (inside the container) even if it is available on RPI host at /media/usb0/share1.
Let’s try to create a music folder and add it to Music media library. Go back to terminal and create a folder by typing:
sudo mkdir /media/usb0/share1/music
go back to browser and click on “Add Media Library”. Select Music on Content Type field.
Then press the cross button near “Folder” label. Here select in “Folder” field the path “/mnt/share1/music”:
Press Ok. Back to the previous page, you can configure your preferences or simply press ok (these settings can be changed later). You’ll se your Music box available:
You can use the same procedure for other media or simply continue setup and add other Media Library later.
Press Next to move on preferred language settings for metadata:
Once setted up, press next:
Here you can configure Remote access or leave as is to allow remote connections. Press Next:
Click Finish to complete setup. On next screen login to use your new Streaming Server.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?