"Optimized for TV" Preset producing 4mbps 720p file

Server Version#: 1.22.0.4163

Quick background: I have a filter set up that automatically creates 4mbps 720p “Optimized for Mobile” versions of any 4K movies in my library. Works great. No problems there.

Then I got the new UHD Bluray copies of the Lord of the Rings trilogy, and created massive 135GB remuxes of the 2 Bluray discs of each movie. And then it created the Optimized for Mobile version automatically, all good.

Since ~85mbps to 4mbps is quite a jump, I figured for these I’d make a 1080p version as well as a middleground. So I tell it to do that, use the builtin “Optimized for TV” preset, and let the encode run.

I come back, and check my File Info to see a 135GB 4K original, a 4mbps 720p Optimized for Mobile file, and a… 4mbps 720p Optimized for TV file??

It’s not the exact same file, but the differences were trivial. 4569kbps 7.29GB Mobile vs 4839kbps 7.72GB TV.

I figure something went wonky with the builtin preset, so tried a custom quality, and specified Universal TV, 1080p, 12mbps. Let that encode for a while, and came back to… a 720p file just shy of 5mbps.

What’s going on here? Why is it not producing a 1080p encode of a 4K movie? So far I’ve only tried it with the Lord of the Rings trilogy, but it happened with all 3 of them. I guess next I could try 1080p versions of some of my other 4K movies…

Here’s the XML entry for the first movie’s files:
15089.zip (16.1 KB)

And log bundle:
Plex Media Server Logs_2021-03-15_15-28-55.zip (4.7 MB)

Quick question - do you have Disable video stream transcoding enabled on the server?

I assume not, but I’ve seen that cause problems with how the Optimizer makes decisions.

Nope, definitely not.

In fact, I have Background transcoding x264 preset on Slower, because I have a fairly beefy CPU (Ryzen 3700X) in this server and am ok with the background tasks taking longer for better results. Even so, they still run at about 5x realtime speed on average.

I see something similar, although not exactly what you’re describing. There’s definitely something wonky.

Strangely, this only occurs with an HEVC 4K HDR source. An AVC 4K SDR source doesn’t behave the same way.

I only see one Optimized Version being created. Any additional Optimized Version that I request isn’t physically created, even with very different settings.

If I first create a Universal Mobile version, any subsequent versions aren’t physically created at all.

If I remove those, and then create a Universal TV, 20 Mbps, 1080p version, it is created as expected. If I then create an Universal TV, 2 Mbps, 720p version, it is not physically created.

If I delete the first version, the next subsequent version is created as expected.

The reason I asked about Disable video stream transcoding is a similar-ish bug I encountered. This all smells :nose: like it could be related.

Quality chosen for Sync and Optimizer ignored

Interesting. Mine was definitely physically creating some file. It ran an encode for 30-40 mins, there was a new file on the filesystem, and it had slightly-but-barely-different properties. It just wasn’t the file I asked for.

I tried deleting both the existing optimized versions, and creating a new one at 1080p 20mbps, and so far the encode is running at about 1.2x instead of the 3-5x the previous ones did, which implies it might actually be creating something higher quality.

So you might be onto something there with clearing out the existing version. Or it might like 20mbps better than 12 or 8. 2 variables got changed in this experiment. I guess we’ll find out in a few hours. Why did I have to decide to do this with a 3 1/2 hour movie? >.<

Even more interesting. If I create the 1080p version first, I can create a 720p version as well just fine. But if I create the 720p version first, any further encodes just produce more 720p results.

Is the optimizer maybe re-encoding from the first optimized file instead of the original?

You can tell for sure if you look at the process list while the optimization job is running.

But I’m (pretty) sure it’s not. I’m 99% sure the Optimizer will only ever start from an original.

The Optimizer is supposed to be clever, and it won’t make a “near duplicate” file if an existing version already “satisfies” the profile.

I’ve got to assume something is going wrong in that part of the logic.

You can tell for sure if you look at the process list while the optimization job is running.

Oh hey, good idea.

docker exec plex-server ps aux

/usr/lib/plexmediaserver/Plex Transcoder -codec:#0x01 h264 -codec:#0x02 aac -codec:#0x03 aac -codec:#0x04 ac3 -codec:#0x05 aac -codec:#0x06 aac -codec:#0x07 aac -codec:#0x08 aac -codec:#0x09 aac -analyzeduration 20000000 -probesize 20000000 
-i /plex/media/optimized/movies/Plex Versions/Optimized for TV/The Lord of the Rings_ The Return of the King (2003).mp4 
<snip>
 -f mp4 -map_metadata -1 -map_chapters -1 -movflags +faststart /plex/media/optimized/movies/Plex Versions/Optimized for Mobile/.inProgress/The Lord of the Rings_ The Return of the King (2003).mp4.1049 
<snip>

Yup. Totally looks like that’s exactly what it’s doing. It’s creating the second optimized version from the first, not the original. (I did TV first and Mobile second this time, and I even queued them both up together before either had actually run, just in case that would avoid this…)

Hey @ChuckPa I think we can officially call this a bug report.

1 Like

Hah, that’s nuts.

It doesn’t explain why you aren’t getting the version you requested, but at least it explains why it’s doing a lot of work to get there. :slight_smile:

Thanks for the investigation on this :mag: . Am writing up bug report.

3 Likes

Does this behavior change if you choose In folders with originals items when you Optimize?

Nope.

I already tried that, each of the three movies in the trilogy got a different combination of file locations in one of my tests, they all had the same result.

Just as an extra data point, I tried making a 3rd 480p version to see what it would use:

 /usr/lib/plexmediaserver/Plex Transcoder -codec:#0x01 h264 -analyzeduration 20000000 -probesize 20000000 
-i /plex/media/optimized/movies/Plex Versions/Optimized for Mobile/The Lord of the Rings_ The Fellowship of the Ring (2001).mp4 -analyzeduration 20000000 -probesize 20000000 
<snip>
-f mp4 -map_metadata -1 -map_chapters -1 -movflags +faststart /plex/media/optimized/movies/Plex Versions/SD 1403/.inProgress/The Lord of the Rings_ The Fellowship of the Ring (2001).mp4.1403
<snip>

Looks like the last/most recent optimized file is used as source, not necessarily the first.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.