Plex – Video Optimization & Converted Files Permissions – Ryan and Debi & Toren

Plex – Video Optimization & Converted Files Permissions – Ryan and Debi & Toren

I was traveling with my wife and son, staying at an AirBnB a few states away from home, and wanted to watch some videos from my Plex server (server software version: 1.32.5.7349) using an Amazon Fire Stick on a Samsung TV. When I tried to play the videos using the Plex app on the Fire Stick, the video would play for anywhere from 2 to about 15 seconds then start buffering and would continue like that, pausing every few seconds to buffer. Obviously, that’s not a scenario that works for watching a video.

Initially, my only way around this issue was to change the quality of the video, dropping it from 1080p to something close to 480p, which is pretty ridiculous. What’s the point of having high-definition videos if you have to watch them in terrible quality?

So, I started investigating the issue because this just wasn’t an acceptable situation…

I knew that I shouldn’t have any problems with streaming the video from my Plex server because of bandwidth, but I figured I’d start there and see if I could figure out the problem. I quickly checked the bandwidth at my house where my Plex server is and it registered the gigabit fiber optic service I have (1 gigabit download and upload). I checked the internet speed at the AirBnB where I was staying and the internet connection was 500 megabits per second. Between those two, that suggested I shouldn’t have any problems streaming the video. Even so, I then checked the internal wifi in the AirBnB knowing that could be the problem. It’s not great internal wifi, but it was still close to 30 megabits per second inside the home. The video I wanted to watch was 1080p, which should work fine on all of these networks.

I then checked all of my Plex server settings making sure I wasn’t artificially limiting my bandwidth. I was not. I rebooted my Plex server and rebooted my Amazon fire stick. I checked a bunch of additional settings and made sure nothing else was running on my Plex server that would be causing problems. I was, at this point, quite baffled. I couldn’t understand why my fairly new, powerful Plex server wasn’t able to serve my video to my Amazon fire stick.

I then tried something else. I tried pulling up the same video via Plex on my phone that was connected to the same AirBnB wifi. It played perfectly. No buffering. No problems. That gave me a hint that eventually helped me solve the problem: CODECS!

I hadn’t bothered to check how old the TV was in the house. It’s a smallish (by 2023 standards) TV, about 40 inches, but it seemed nice enough. Even so, knowing a little bit about audio and video codecs, I began to wonder if the problem was that the TV wasn’t capable of decoding the codec of my video. I have converted all of my video files to H265, which is a relatively new video codec. The TV, a Samsung LN40C530F1F, was manufactured in 2011. That got me wondering… The TVs at my home are all fairly new and, to date, I hadn’t been to any other locations where I had tried to play videos using my Amazon Fire Stick where the TV had been old enough to run into this problem.

And, luckily, this realization pointed me toward a solution to the problem.

Plex has an option, one I haven’t used in the more than 10 years I’ve been a Plex user, to “optimize” videos (Settings -> Optimized versions):

I pulled up the video and clicked on the three dots that show up on the bottom of the video that give you additional options. In that list is an option to “Optimize” the video:

Yes, we were trying to watch “65.” And, no, it’s not a great movie.

If you click on that, it will give you a new screen:

I clicked on the first drop-down option that indicates what you want to optimize the video for and selected “Optimized for TV.” I wasn’t exactly sure what that would do, but I figured I’d give it a try (there is another option for “Custom” that will give you more control over the resulting video file). It took my Plex server about 4 minutes to create a new version of the video, then I tried playing it through the Amazon Fire Stick and… Et voila! It played perfectly, in high resolution, with no buffering issues at all!

So, I figured I had solved the problem. But, I wanted to make sure. I pulled up the original video file (1.9gb in size) I was trying to play that wouldn’t work on this TV and checked the codec. Here’s what I found:

Stream 0
Codec: MPEG-H Part2/HEVC (H.265)(hev1)
Type: Video
Video resolution: 1920×800
Buffer dimensions: 1920×800
Frame rate: 23.976216
Decoded format:
Orientation: Top left
Chroma location: left
Stream 1
Codec: MPEG AAC Audio (mp4a)
Language: English
Type: Audio
Channels: 3F2R/LFE
Sample rate: 4800 Hz
Bits per sample: 32

I bolded the important codec information.

And here’s the codec information for the optimized version of the same video (5.2gb):

Stream 0
Codec: H264 – MPEG-4 AVC (part 10)(avc1)
Type: Video
Video resolution: 1920×800
Buffer dimensions: 1920×800
Frame rate: 23.976000
Decoded format:
Orientation: Top left
Chroma location: left
Stream 1
Codec: MPEG AAC Audio (mp4a)
Language: English
Type: Audio
Channels: 3F2R/LFE
Sample rate: 4800 Hz
Bits per sample: 32

Again, I bolded the important codec information.

Sure enough, this appeared to be a codec issue. My original file was using the H.265 codec and the optimized file was using the H.264 codec. Everything else between the videos was the same. Just to make extra sure this was the issue, I found the user manual for the Samsung TV and searched through it for codecs. Here’s what it indicated about supported file formats:

Sure enough, the TV supported H.264, but not H.265. It was my more modern codec that was causing the problems. The optimized version solved this because it was using H.264, a codec the TV supported.

I thought I was done with this issue, but, of course, I ran into another problem. Once I had figured out the optimization solution, I tried it with another video on my Plex server and got an error. When I clicked on Optimize, it said it couldn’t optimize the file. When I clicked on the list of Optimized files, then clicked to see what was going on, I got this error:

“converted files cannot be written to the server’s disk”

Ugh. Now what?

Luckily, as a Linux user, my first hunch was correct. This was a permissions issue. Some of the videos were stored in folders on my server that had restricted read/write/execute permissions. Here’s an illustration from my fileserver showing that some of the directories allowed full access while others have slightly restricted access:

I was able to log into my fileserver remotely and “chmod” the directories to give the Plex server full read/write/execute access to those folders. Once I did that, the error I was getting when I tried to Optimize video files in Plex went away and I was, once again, able to optimize my video files.

In sum, the buffering issue was due to me trying to play H265 videos on a TV that only supported H264. My optimization issue was due to permission issues for the folders where the videos were stored. Hopefully, this helps others if/when they run into similar issues in the future.

Loading

https://www.ryananddebi.com/2023/08/02/plex-video-optimization-converted-files-permissions/

Recommended For You

Leave a Reply