How to find media items with missing preview thumbnails?

Server Version: 1.20.0.3181
Player Version: n/a

I have a handful of videos that are failing to generate preview thumbnails, but I’m not sure which. I see Plex periodically retrying and get errors like these in my log when preview thumbnail generation fails:

ERROR - BaseIndexFrameFileManager: expected 2033 images, but found 657

There’s nothing indicating which file failed, however. Sometimes I’ll catch it in the act and see which file it’s trying to read using resource monitor and can track it down that way.

However, is there any way to simply query which items are missing thumnbnails? I’m currently digging through the database trying to find this, but maybe someone has already figured it out.

ExportTools is your friend

2 Likes

A few of us were troubleshooting this issue. When you figure out which files are failing, I’d be curious to look at a sample and see if it’s the same issue.

If they’re files that you are ripping and encoding, we can give a couple of pointers for how to address it.

https://forums.plex.tv/t/video-preview-thumbnail-generation-fails-with-certain-blu-ray-rips-not-re-encoded/

First of all, this req. that the OS of the PMS is Windows :wink:
Secondly, you are fetching all medias, as well as unneeded info, like collections in one go!

Above puts a huge demand towards the database => if a large library, PMS might hang for others in the mean time.

ExportTools req. information in small chunks of 30 a time, and as such, have minimal impact on the database

To be technically correct (the most annoying kind of correct) PowerShell is available for other operating systems.

GitHub - PowerShell/PowerShell: PowerShell for every system!

Did you experience issues making large queries? That sounds like fun story time.

Speaking only of SQLite itself, there shouldn’t be any issues with big queries. Readers don’t interfere with each other, readers are isolated from writers and get a coherent view. Writers mostly compete for locks with other writers. WAL is super sexy.

If I use @skippy10110’s method I can get all of the XML for my whole medium-sized library in a fraction of a blink, even on a slow server. But the server isn’t doing anything else.

BUT I don’t mean to imply I know anything about how it works when going through Plex and the Plex API. Your warning sounds like the voice of experience. Blocking Plex for other users is Bad. I’ve noticed that deleting a Library triggers a Database Optimization, which blocks EVERYTHING. And my library isn’t “big” and my userbase is “small”.

(Happy ExportTools user here! Thank you!)

Once you start thinking with objects, PowerShell is downright amazing. The first step on the learning curve is pretty steep though. It’s hard to recommend to people who aren’t immediately excited about it.

You should dump your work on GitHub or something. :slight_smile:

I think many of the things you describe are things other people want also. I’ve been playing more with tdarr lately because it integrates some of those operations into one pipeline.

All code, always! Being proud of code is the best reason to KEEP maintaining it. I dunno how anybody ever publishes anything in the first place …

I think that’s what’s hard to capture when explaining the value of code comments or documenting business decisions. Nobody cares that you’re setting x to 3, it’s obvious from the code.

It’s WAY more interesting to document “Tried extracting text, turned out to be a PITA. Too many variables, dependencies, too fragile. Counting packets was easier/faster/reliable and sufficient.”

It’s also clever and elegant, by the way. I love recognizing that I can throw out 99% of the work I’ve done just by shifting my perspective.

The comment “Setting this to 3, because 1 wasn’t big enough and I didn’t have time to test more” is just as useful as “This value was carefully tuned, based on x, y, z”.

I think that same way. 0 is so special that it’s more recognizable as 0. Kinda goes back to the other part of the discussion, too.

1 Like

Correct, I keep forgetting about .Net Core :wink:

Nope, since my libraries ain’t that big.
During the time where ExportTools was named Plex2CSV, I was asked by a Plex dev to use paging, which I didn’t even knew existed :wink: so I changed my code to use it, since Plex should know, and also use that them self

Interesting! And totally confusing to me.

I think of paging as a human convenience feature that usually increases load on the server. In the pathological case it might require the server to select and sort the data repeatedly.

Yeah - looked at your code. The way they’ve had you add paging confuses me for sure. I don’t see how that isn’t a lot more load on the server overall. It also means you could miss or duplicate media if the library is changed while you’re looping through.

I mean obviously you be a good citizen and do what Plex asks, but I sure don’t get it.

Huh…For each call you set a start of the container, and how many items you want. Then repeat until no more items

Not sure, but ain’t you the only guy adding to your server, and as such control that?

And lastly, it’s not only the database, but also the result, that is kept in memory until delivered, and in one big transmission, instead of in small chunks, => others can also be served

Just because I love showing how sleek Powershell can be… :slight_smile: , here’s a slightly prettier version of what I had above:

$plexToken = "bla"
$libraries = @(
	@{ Id = 1; Type = 1; } # Movies
	@{ Id = 3; Type = 4; } # TV
)

$librariesXml = $libraries | % { irm "http://127.0.0.1:32400/library/sections/$($_.Id)/all?type=$($_.Type)&X-Plex-Token=$plexToken" }

$missingThumnbnailFiles = $librariesXml.MediaContainer.Video.Media.Part | ? { !$_.indexes } | select -Expand file | sort

Write-Host ($missingThumnbnailFiles | Out-String)
1 Like

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