Monday, December 20, 2021

Plex Sucks! or Building a Better Media Server

Update 9/29/22

Over the last several months, I've been having increasingly frequent problems with my TV streaming. I had a Chromecast with GoogleTV plugged into the TV, and a Bluetooth transmitter that used the aptx low latency codec connected to the TV via optical fiber. I also had some Bluetooth earbuds that used the aptx low latency codec so the audio and video stayed in sync (a problem with my Sony WH-H1000 headphones I got from Costco a few years ago).

The problems I was having with TV streaming were buffering issues with the dreaded spinning circle of dots showing up and interrupting almost everything I tried to watch, whether it was streaming YouTube or Netflix via Wi-Fi, or coming from my Jellyfin server. When I didn't have the circle of dots, I had very low quality video. My Jellyfin server couldn't stay connected and was often unwatchable.

When I was seeing problems, Chromecast always reported excellent signal strength. I'd stream the same video on my computer that is wired directly to the router and there were no issues. So the problem seemed to be the Chromecast dongle. I tried factory reset and it didn't help. 

Now I'm wondering if the problems I was having casting video from VLC on my computer to the Chromecast dongle (see the original post, below) were because the Chromecast was starting to crap out.

I did a little research and decided to replace the Chromecast. I ordered an Nvidia Shield TV Pro (NSTP). The NSTP replaced the Chromecast and the Bluetooth transmitter, and even with my Sony Bluetooth headphones that don't have the the low latency codec, audio and video are in perfect sync. Best of all, the video is now perfect, and my Jellyfin server streams perfectly again.

I don't know what happened to the Chromecast- it worked well when I first started using it, but performance degraded to where it was unusable. So, if you're going to run you own server or just stream video to your old TV via Wi-Fi, get the Nvidia Shield TV Pro!

Now back to the original post:

I've been using Plex Media Server to stream video from a computer on my home network to my TV for years. It started out OK, but sometime in the last few years they decided to become a media streaming empire, requiring annual fees and connection to their servers even if I just want to stream stuff from my local HDD. The real kicker is the frequent re logins required. I use TFA with a Yubi key to access my passwords stored in Lastpass. That makes re logging in to Plex a major PITA, especially if I'm sitting in front of the TV with only my phone. To make matters worse, the web address that appears on the TV for logging into Plex doesn't actually work. I don't want any of Plex's streaming services. Why should I have to keep re logging into Plex and paying them an annual fee to access media on a computer on my own network? 

I was frustrated, and tried using VLC on my main computer to cast video to the Chromecast With GoogleTV dongle on my TV, but it was very unreliable. 

I decided to look for an alternative to Plex and casting via VLC. Searching the term "plex sucks" brings up many hits. It seems I'm not the only one who dislikes Plex. After a bit of digging, I found a pretty good replacement that will stream video from a local HDD to the Roku and Chromecast dongles I have on my TVs. It's called Jellyfin

With a media server there are a few things to consider: 

Can it stream high bit rate video/audio reliably to the targeted receivers? Does the audio (i.e. surround sound) work when streaming video? How do you get media files into the server?

I'll consider each below.

1) Streaming high bit rate video

I did some searching for Jellyfin hardware requirements and couldn't find much specific info, but did find several comments in forums from users who were using relatively low performance computers (even RPi!) to stream 4k video successfully. 

The old Plex server was an ancient desktop PC that used a lot of power, took up a lot of space, and had a bunch of noisy fans. For the new server I decided to try a Dell Optiplex 3020 Micro that I picked up at work when they swapped out all the desktop computers. It has a core i5 processor and 4 GB of RAM.

The server with cover off. The HDD is supposed to fit into a plastic carrier that snaps into place, but this 15mm thick drive won't fit into the carrier.

The server closed up. It's about 7" square and 1.5" high (180x180x38mm)- very small!

Before springing for a big HDD, I wanted to test the whole system to see how hard it would be to set up and if it would reliably stream video to my TV, so I installed an old 250 GB HDD. The Jellyfin web site listed compatible operating systems, and I chose Ubuntu Server 20.04.3 LTS to minimize OS overhead (no GUI, no office apps, etc.). 

I downloaded Ubuntu server using a torrent, then made made a bootable USB thumb drive with the disk image using Rufus. I'm not linux master, so I followed instructions for installation on the ubuntu web site, then updated all the OS software, and finally followed step by step instructions at this site to install Jellyfin.

As soon as I got Jellyfin working I put a few media files on the OS HDD and set up the libraries in Jellyfin and tested it. Yes, it worked. In fact, the defaults for everything except audio worked without any messing around. The UI on a web browser and on the TV was great! Jellyfin pulls metadata on the media files from the web and displays everything as well as Plex ever did.

2) Does audio work when streaming video?

I ran into one problem when sending files to a Chromecast dongle on one TV. Chromecast couldn't understand the DTS surround audio streaming from Jellyfin. Chromecast is OK with Dolby Digital (AKA AC3), and Dolby ATMOS. I had to set Jellyfin to mix the DTS surround audio down to stereo for Chromecast to play any sound from files that had DTS audio. Files that used variants of Dolby encoding worked fine as direct stream. It would be nice if there was an option to have Jellyfin do that mix down automatically. The audio mixdown is selected from the Jellyfin home screen settings menu, so it's easily accessed when needed.

3) Getting files to the server

The server is located in the basement at my house and operates headless, so I need to transfer files to it from another computer via the network. The other computer is a Windows machine so I installed filezilla and used sftp to transfer files from my desktop machine to the server. It works perfectly, and very fast.

I use Secure Shell in a web browser to log into the server remotely to do things like update software, etc.

Additional notes:

The Dell computer I chose to use is very nicely made. It's really small, and everything snaps in securely without tools, and there aren't any cables to mess with. Very nice! Except.... the HDD fits into a plastic carrier that snaps into the enclosure. The carrier can only accommodate 2.5" drives up to 9 mm thick, like those used in laptops. The 4TB drive I ordered is 15mm thick. It fit the connector just fine, and didn't prevent the case from closing, but wouldn't fit the bracket, so I cut a piece of foam rubber and put it under the drive to support the free end, then closed the case. I probably wouldn't want to pick up the case and shake it, but short of doing that, the drive isn't going to move.

The computer has a couple USB3 ports, so if I need to go beyond 4TB of storage, I'll add it externally.

I ran into one problem after I installed the 4TB drive and Ubuntu and Jellyfin. When you install Ubuntu server it uses as much HDD space as it needs and leaves the rest of the drive unprovisioned. I discovered this when I tried to transfer a bunch of media files to the drive and transfers kept failing. It was running out of space! Once I realized what was happening, I reinstalled Ubuntu server and this time, when it was provisioning the storage, I made sure to include the empty space on the drive. Yes, I know, there are several ways to do it without reinstalling the OS, but that was easier and faster than trying to figure out how to do it using Grub or other disk manager.

I am sure there are ways to do it, but I did not attempt to set up remote access/streaming from my server across the web.