Optimizations Failing for 4K HEVC/TrueHD 7.1 Content

I have a problem with 4K files failing to optimize. Sometimes, they will eventually optimize, but nothing has changed server-side.

My understanding is that the temp directory for optimizations is inside the “Plex Versions” directory, and I have plenty of room there. I’ve tried cleaning my bundles and DB.

The logs don’t seem to reveal much beyond a “failure” occurring. This always happens at the very end of the transcoding process.

May I see the logs? (all of them… The ZIP file)

Please see the attached.

Thanks.

Nothing is jumping out at me but I’m not seeing any actual SYNC activity.

I am only seeing some playback start/stop activity. Of modest concern is this:

Jun 03, 2018 06:14:03.865 [0x7fb0d1bff700] ERROR - Transcoder: Failed to delete session directory (boost::filesystem::remove: No such file or directory: "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions/plex-transcode-692361C5-D8F7-4150-95BE-AB4BD2F8CCE7-6a5326c6-f780-45df-bbad-d016a461b11a")

If I remember correctly, that’s an overcautious error (false positive) and is being taken care of. (it reports error if it’s already been deleted).
Nonetheless , If you’d double check for me and make certain permissions in the Cache directory are as follows

This makes certain directories are 755 by default and files are 644.

sudo sh
cd /var/lib/plexmediaserver
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Where is your transcoder temp set (Settings - Server - Transcoder) because it is what’s used in conjunction with the Plex Version destination directory

I haven’t changed the default temp directory (still an empty value). For optimizing, I thought that the temp directory wasn’t used; only the Plex Versions directory?

If the temp directory specified in that path is used for optimization and/or sync, an issue could be that while my library is on a 20TB mount, the OS and Plex are on a 120GB SSD. Since these files are pretty big, could that cause an issue?

Also, the command:
find . -type d -exec chmod 755 {} \; hung after running, or is taking a really long time…

It can take a LONG time. You should see disk activity.

If your temp directory is at the default, it defaults to /tmp which is usually tempfs (ramdisk) on normal Linux

With your VM running, did you give the VM enough RAM? Default configuration is up to 1/2 of available RAM.

After waiting, both commands did complete.

My VM is in a Delimiter managed instance of Ubuntu 16.04 LTS on a VPS, but I have 10GB of dedicated RAM.

No idea what that is but it’s a QEMU VM so that’s fine.

If you can recreate the failure and capture immediately after it happening, that will be what I need.
Nothing has shown in your logs so far. I need to see the failure to diagnose further at this point

Here are newer logs which do show an optimization failure.

Is this the error you speak of?

Jun 04, 2018 02:32:26.755 [0x7fb0df3fe700] DEBUG - Completed: [127.0.0.1:51116] 206 PUT /video/:/transcode/session/4bd17345-fd2b-4835-aaf0-15c4f4b3c132/4fa98927-bb2c-4b3d-9949-995706bba9eb/progress/streamDetail?index=9&id=0&codec=hdmv_pgs_subtitle&type=subtitle&language=eng (9 live) 0ms 227 bytes
Jun 04, 2018 02:32:26.763 [0x7fb0bc3ff700] ERROR - [Transcoder] /content/Movies/Plex Versions/Optimized for TV/.inProgress/Blade Runner 2049 (2017).mp4.18: No such file or directory
Jun 04, 2018 02:32:26.773 [0x7fb0da3ff700] DEBUG - Jobs: '/usr/lib/plexmediaserver/Plex Transcoder' exit code for process 25912 is 1 (failure)
Jun 04, 2018 02:32:26.775 [0x7fb0b2ffd700] DEBUG - Cleaning directory for session 4bd17345-fd2b-4835-aaf0-15c4f4b3c132 (/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions/plex-transcode-4bd17345-fd2b-4835-aaf0-15c4f4b3c132-05ab817c-499c-4042-82c0-4411cdfe1e7e)

This is unusual because error code 1:

[chuck@lizum ~.101]$ perror 1
Exit code(1): error "Operation not permitted"
[chuck@lizum ~.102]$ 

It occurs when the codec needed does not have execute permission and/or is mounted on a directory where (under /var/lib/plexmediaserver)
a. the noexec mount option was listed when it shouldn’t be
b. the exec wasn’t specified when it should be.

The error isn’t specific beyond the ‘yes/no’

If your /var/lib/plexmediaserver directory itself is over the network, this will be where the problem is.
You should also be careful to guarantee local file locking is enabled (if NFS v3). It is included by default with NFS v4

Yes, that’s what stood out and the file that failed. Apologies for being dense, but how can I;
A. check to see if the codec has execute permissions
B. look st the current mount options

My library’s directory is mounted locally, so hopefully the above is the issue.

If you have moved the default /var/lib/plexmediaserver directory, which is on the root partition by default (where there is exec privilege by being under /), to another partition then the simplest solution is to add ,exec to the mount options for that local partition and reboot.

I haven’t moved the /var/lib/plexmediaserver directory from the root directory.

If I look in /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Codecs/ all of the codecs have permissions of 644. I should say automatic optimization is working for some files, just not the ones I’m focusing on in this thread. Could this permissioning be an issue?

Also, while var/lib/plexmediaserver lives on the main drive /, my content is on a different drive:
/ = /dev/vda
/content = /dev/vdb

Those are all correct. Codecs are shared object libraries. They should be 644 to load into the runtime on demand. The noexec flag is a security mechanism. It’s part of what helps keep Linux insulated from viruses.

Since permissions are valid, I’m suspecting a simple case of incomplete download which does happen.

The easiest solution is to stop PMS and delete the codec files.
When you next play a file which requires one of those now-missing codecs, it will simply download again. You will observe this as a few extra seconds before it begins playback. Once downloaded, normal playback start will return.

This is also the simplest way to verify: Delete all, play the problematic movie again.

To clarify, should I delete just the actual files or the two directories that contain codecs?

That’s the easiest.

  1. Stop PMS
  2. Delete
  3. Start PMS

Unfortunately, that didn’t solve the problem. Please see the attached logs.

Please give me the XML of what you’re playing and tell me what the player settings are. I need to recreate, or minimally understand, the precise playback environment.

Also please confirm, “The Matrix” is what you’re trying to play. If there is other activity, the more quiescent the server, the easier it is for me to keep things clear.

One thing I am seeing immediately The Matrix cannot be direct played due to the subtitles being enabled. The previous hardware-transcode attempt failed (either not supported on that CPU/ASIC or other reason). 4K HEVC minimally needs a SkyLake class if SDR. It needs ApolloLake if HDR

Please find the XML attached. I am trying to use the default “Optimize for TV” automatic optimization setting. The movie I am trying to optimize is “The Matrix.” I have tried to stall all other activity from occurring when it is optimizing the films for our debugging purposes.

I don’t have the hardware transcoding option enabled, so I have been wondering why hardware transcoding is being attempted…

Thanks for the XML. Now I see very clearly what pms is trying to do.

Please tell me that VM is running on some serious CPU power? The CPUs I see offered on Delimiter’s site are typically 9000 Passmark Xeon CPUs.

2160p, HEVC, HDR, 53 Mbps, a bunch of audio codecs, and PGS subtitles (image based) on a CPU that small will take a VERY long time to optimize.

have you actually caught it failing?