banner



What Does Plex Use to Match Anime

These are of course just the trailers...

In past years I went back and forth between Plex and Emby as my media server of choice but eventually settled on the former since I switched my server to my desktop PC to an Nvidia Shield, then to a Docker container in a Synology NAS. It's very easy to get started with Plex, but as you add different types of content and grow your libraries, it becomes more and more complicated to keep everything tidy and easy to use. I have 100TB+ in Plex organized in a dozen different libraries, learned a lot along the way, and will share my notes in this entry.

As a caveat, this post is not about streaming or transcoding, I'm using Plex in Direct Play on my LAN and do not care about serving low-quality transcodes to the entire neighborhood as some people seem keen to do. (I'm not judging, it's just that I'm not interested nor experienced with this use case).

The ways we are interacting with a tutorial, audiobook, movie, or TV series are all very different, and it takes work to bend Plex to be a good fit with all these scenarios. If you have to take anything from this post, it's that each type of content needs its own library with an approach that's finetuned to it.

As much as I try to use automation and rely on Plex's native features, to achieve the best results be prepared for some grunt work to get more obscure content organized neatly and in line with how it's meant to be consumed. I try to stear away as much as possible from organizing or tagging content via the Plex UI, as that metadata won't survive if you have to rebuild a library from scratch, which over the years is likely to happen eventually. Instead, metadata is best conveyed via 1) your folder/file organization and naming conventions, 2) by metatagging source files themselves, and/or 3) with helper text/json/xml files to be parsed by Plex agents or scripts.

If you're not willing to make that effort, well, garbage in garbage out, you'll get out of your libraries what you put into them. And the more content you add, the more you'll need it to be organized or the whole thing will collapse under its own weight.

1. Matching Recalcitrant Documentaries, TV Shows, Movies, Or Sports

Provided you apply the recommended naming conventions (TV, movies), Plex is usually good at auto-matching and fetching the right metadata, especially since the new movie scanner and agent were introduced with PMS 1.20. However, some content types can be tricky and tiny punctuation variations can throw the agents off (e.g. you can't put colons in Windows file names), as well as titles in other languages than English. Follow these guidelines to save you a lot of grief, depending on the type of content you plan to collect.

Documentaries can't be all dumped in the same library. Instead, make sure to put standalones (e.g. Tropicália) in a Movie library while series (e.g. Chef's Table) should be in a separate TV library. Some are tricky as you may think they're standalones but they're actually part of an extended TV series of sorts (e.g. content from National Geographic). Look up these loose ends in TheTVDB and IMDB TMDB then decide whether to put them in your TV or Movie documentary libraries accordingly (edit: someone pointed out I made a mistake, it looks like IMDB is used by Plex just for ratings, like Rotten Tomatoes).

After I initially posted this entry someone brought Colima to my attention. I think I'll stick to my approach, but it's good to have options:

"Combined Library Metadata Agent (Colima) in combination with Absolute Series Scanner (ASS) allows you to have movies and tv shows within the same library, something that Plex sadly not supports out of the box. Common scenarios to use this agent for are documentaries, western and Japanese animation libraries."

Colima.bundle README.md

To automatically enforce Plex's naming convention on TV shows, use a tool such as Sonarr, Filebot, TV Rename, or Rename My TV Series. TV shows should match in most cases if they're properly named, but in the rare case that they won't, find the offending series in TheTVDB then force a match by ID. With the new Plex TV Series agent, you might need to append "thetvdb-" to the ID.

You can do the same ID matching with IDs from TMDB in movie libraries. Movie libraries also work for stand-up comedy shows, which I chose to set up a separate library because for me it's a different mood, time commitment, and audience than watching a regular movie. This is why I also have a separate library for family movies but from a technical perspective you don't have to use separate libraries in these cases, it's more of a convenience. (I made that structural choice before the addition of Smart Collections, which we cover later in this post).

Your mileage may vary with sports depending on whether individual events can be found in Tmdb or TheTVDB. UFC fights (I mean free trailers of course) for instance are recognized if you set them in a movie library. Here's a reddit thread discussing success handling Formula 1 seasons and here's a thread about NBA/NFL, a similar approach may or may not work for your sport of choice.

It's impossible for me to track all the ways people use Plex though, as there are many niches I have no interest in. For Anime there an agent called HAMA, some people want to handle radio shows, podcasts, comics, etc. There's a whole subreddit and website just for preroll videos!

2. Getting the Best Experience for Tutorials: Use mp4 Tagging Or A Custom Agent

Multi-part video tutorials is the content type I found most tricky to handle, as the big public databases don't have metadata about them. There are two main approaches to this challenge, each with their pros and cons. Again, you want to refrain from doing a lot of work via the Plex UI as you'd have to redo it all over again in case you need to rebuild your library for whatever reason. With computers, nothing is permanent so plan accordingly.

2.1. The Embedded Metatag Approach

A first round of trial and error led me to using collections with the following settings:

  • Library type: Movies. If you use Other Videos you'll have to merge video parts manually in Plex, which would need to be redone if you ever have to reset said library, which in my experience is bound to happen.
  • Scanner: Plex Movie Scanner.
  • Agent: Plex Movie (legacy).
  • Hide items belonging to collections (stacked content is based on Collections).
  • Rename files with a tool such as Flash Renamer, following the "- partx.ext" convention.
  • Group parts of the same tutorial under the same "album", by tagging files with mp3tag. This works on mp4 video files so if you have AVIs or MKVs you'll want to convert them with VLC or Handbrake first.
  • For categorization I don't use tags, which never got any love in the Plex UI, but rather self-defined genres.
  • You can add specific artwork for each video segment (i.e. if you have different files within the same tutorial), which will make it easier to pick the right one among the 20 parts of a long tutorial. Some media players such as mpv make it very easy to save screenshots in one keyboard shortcut.
  • You might need to generate your own posters as tutorials about underwater archery or Roblox origami are not necessarily going to come with something good looking for Plex purposes. The expected aspect ratio is 1:1.5.

This turned to be a manageable but not entirely satisfying workflow in the backend, and the end result in the frontend is a decent but not optimal user experience since navigating a large library will mostly have to be done via the Collections tab. There must be a better way!

2.2. The Agent Approach with Helper Metadata Files

As an alternative, a better organization may be obtained by following the TV show/season convention, and even more control can be supplied by custom agents. It's a shame that Plex stubbornly lacks support for long-established .nfo files, but people have been complaining about it for years to no avail so I'm not holding my breath. I tested four options and have adopted one that ended up being as close to my ideal requirements as it's going to get.

  • Personal Shows Metadata Agent – this is the best option I found for tutorials. Its meta.json format supports genre tags, studio, and cast, but it could be more thorough as there was initally no support for some fields such as collections, tagline, or originally available date… I hacked the Python source code to add these fields, a tweak that the author then officially added to his code. If you're willing to do the legwork to conform to the TV show structure and naming convention required by this agent, then the result is very satisfying.
  • Extended Personal Media Shows Agent (forum thread). Like the previous one, it unfortunately doesn't leverage agents that harvest mp4 tags and there's no way to set cast (actors/directors), Genre, or Studio. This agent relies on following a specific naming convention with optional .summary and .metadata files.
  • XBMCnfoTVImporter – This plugin is meant recognize the type of nfo files used by Kodi, but documentation is nonexistent so while this is probably a good option, prepare to fumble in the dark.
  • AvalonXmlAgent – inspired by XBMCnfoTVImporter, but with a different XML file format. Looks good but doesn't handle season titles. My first attempt with it didn't work too well though, I think I'll stick to the Personal Shows Metadata Agent.
  • Local Assets-Metadata Double Agent (forum thread) – similar in spirit to the above but with the added twist of letting you save Plex Metadata locally (i.e. it does import/export).

The agent-based approach is also what I'd recommend in case you want to organize your own home photos or videos. For photos there's an autotagging option but it's calling a third-party service – which you may not want to do for privacy reasons – you need Plex Pass to be able to use it, and it's reportedly no match with Google Photos's face recognition.

For the best result with custom cast members, save square .jpg pictures of close-up mugshots in a dedicated web folder. Common cloud services such as Google Drive or OneDrive make this way too hard for some reason, I serve these images via a local web server on one of my Synology NASes.

3.1. Audiobooks Are One of the Most Challenging Use Cases

Dedicated support for audiobooks is one of the top open feature requests but so far, they still require that you jump through similar hoops as tutorials for the most part, except as a Music library and using a special-purpose agent. On the frontend side, the official Plex clients are not the best to keep track of progress time across devices and other UX niceties specific to listening to audiobooks. For details see:

  • Audiobook Guide 1 – macr0dev agent
  • Audiobook Guide 2 – Seanap agent (a few differences and more recent)
  • Chronicle Audiobook Player for Plex, there's also Prologue but it's iOS only
  • Bookcamp: coming app for iOS and Android that promises Plex backend support
  • Play audiobooks outside of Audible on Alexa devices
  • Alternative approach for multipart audiobooks using mp4s in a Shows library.

A significant limitation of audio libraries is that unlike Movies and Shows they don't support collections.

There's no built-in way to tell apart movies with a commentary track at the library level because the audio stream metadata is not leveraged for navigation. Some people use MKVToolNix or ffmpeg (using ISO codes) to set the commentary soundtrack to a rare language such as Icelandic, while others suggest Tautulli but that seems clunky at best. Alternatively, you could use sharing labels, which require Plex Pass, or create a "Commentary" tag within Genres or Collections. I elected to do the latter, but didn't want to maintain it manually through the Plex UI, so for a long time was stuck without an acceptable solution.

That changed in March 2021 the author of Plex-Meta-Manager (more on that tool further below) added support for filtering by audio_track_title at my request, which takes care of the commentary track. In your Movies.yml metadata file, have a section like this (be careful with indentation as the dastardly YAML language is looking for excuses to fail):

          collections:   Movies with Commentary:     plex_all: true     filters:       audio_track_title: Commentary     sync_mode: sync     collection_order: release     summary: Movies with commentary audio tracks from the director or critics.        

If you wanted to create collections by audio track codec (AC3, DTS etc.) as someone asked in the comments below, this is also the way to go.

3.3. Use Smart Collections to Dynamically Categorize Content According to Search Filters

For all the metadata exposed by the Plex search user interface, you don't need the aforementioned script. Simply configure an advanced search and save it as a smart collection, a feature added in April 2021 that was a great improvement to Plex.

I've used smart collections to categorize documentaries by genre: Arts, Music, History, Nature, Science, etc.

Smart Collections will automatically add new content matching their criteria
I have hundreds of documentaries so I wanted to be able to browse them by theme

I also set up collections manually (i.e. not based on filters) by audience, i.e. content for the entire family, that only my wife watches (mystery and police procedural galore!), that I watch together with her, or that we watch with our daughter but our son is not interested in. That way, depending on who's in the mood to watch a TV episode or movie, we can narrow the selection down to that specific audience. And my wife can start watching new shows I downloaded for her without accidentally watching someone I intended to watch too. I already have enough libraries as it is without creating libraries by genre or audience!

3.4. Playback Speed: Only on Devices That Support Browser Extensions

Playback speed is something that people often want to control for audiobooks and tutorials, and to a lesser extent sports, but despite popular demand it's still not found in any Plex clients. There's a third-party Chrome extension – which means it also works in Edge Chromium – but that obviously won't work from your TV or tablet app.

If you must have playback speed control in mobile devices then you're better off using Emby, at least for the library for which you have that need.

4. Adding Chapters to Make Long Videos Easier to Navigate Around

Some long tutorials can be cumbersome to navigate, while other types of content, from sport events to concerts may also benefit from having delineated chapters. If you're ripping DVDs or BluRays, ChapterGrabber will help you get chapter information from the source, and there's also the ChapterDB archive for (some) movies.

When chapter information is not already available, you can add your own chapter information within videos with software such as Handbrake or Drax. In any case this needs to be done in the video files before importing them into Plex.

The power user approach to this task relies on ffmpeg, best combined with a helper script so that you can write a simple text file listing your chapters then writing them back to the video's metadata. The python dependency makes this overkill if you have just a few videos to "chapterize", but who doesn't like to spend 5 hours to automate a 15-minute manual job anyway? If like me you're running on Windows, make sure to save your chapters.txt file with Unix end of line characters (LF), which is easy with Notepad++, otherwise you'll end up with ugly rectangles at the end of each chapter's title. Here's a recap of the procedure tweaked to my own preferences, I do at least a few at a time to get into the groove of things:

[File Explorer] Make a copy of the video to be chapterized to your work directly and rename it input.mp4
[Notepad++ and mpv.net] Write down chapter timestamps in chapters.txt while speed-watching through the video. Doublecheck there are no typos.
[Command prompt] ffmpeg -i input.mp4 -f ffmetadata ffm.txt
[Visual Studio Code or Python-aware CLI] run helper.py
[Notepad++] Open ffm.txt and convert EOL characters to Unix
[Command prompt] ffmpeg -i input.mp4 -i ffm.txt -map_metadata 1 -codec copy output.mp4
[mpv.net] Open output.mp4 and navigate to each chapter to make sure the timestamp is exactly right and triple check for typos
[File Explorer] Rename output.mp4 and move it to the library folder where it's supposed to go

While you can set art for seasons and episodes, thumbnails for chapters can't be set manually with local images, they're automatically generated by Plex based on each chapter's exact timestamp (related thread). Meaning that you'll have to tweak your chapter timestamps almost by the exact frame to get the best results. Well, that's not entirely true, you could edit the files generated by Plex in the Media folder in the backend, as explained by Noel Plum in the comments below. He's been doing it for months without issue, but there's no telling whether future changes in the PMS code won't mess with that eventually.

With MediaInfo GUI you can quickly check whether any given video file already has chapters, and export that list to a text file. You may want to do so in order to edit it and reload it back to its video source in case the existing timestamps don't quite work for you (e.g. bad preview thumbnails), or to remove or add to the list. The equivalent with the MediaInfo CLI is:

          mediainfo.exe input.mp4 > metadata.txt        

The output will need to be cleaned up and reformatted a bit if you want to reinject it as per Kyke Howell's helper script mentioned above, but it's not too bad. Alternatively you can use ffmpeg to extract that metadata as also shown by Kyle, with the major inconvenience that timestamps are shown as an integer based on a timebase, or you could use mp4box from the command line, which will generate a ttxt XML file (which then needs to be scrubbed) with hh:mm:ss timestamps (that's the good part):

          mp4box.exe "FilePath" -dump-chap >chapters.ttxt        

If need be, you can also scrub existing metadata and chapters with ffmpeg.

Also, it seems you can't force the generation of chapter thumbnails so you'll have to wait for your scheduled process to kick in. Once they're rendered, here's what that looks like in the web UI (according to what I read chapter support varies among Plex clients):

This guy is a fountain of grappling knowledge, but also talks slowly and repeats himself constantly. Trust me, you want to chapterize him!

5. Misc Library Customization & Management Tips

  • If you want your library to look ultra clean, consider using custom posters and fanart such as those found on The Poster Database. I've used this for my thematic collections but for individual movies I'm waiting for that site to add a Plex agent and direct integration into the Poster tab shown when you edit an item. Some people even go through the trouble of customizing episode cards, among other reasons to avoid spoilers ("what, this character in the thumbnail died two seasons ago?!")
  • For music, some people are raving about Plexamp, I haven't used it. I'm not currently handling music albums in Plex, I'm sure this would turn into a whole chapter in its own right.
  • You'll probably want to customize which libraries are part of global search and featured in dashboards, i.e. On Deck and Recently Added. That's done in the Advanced Settings of each library.
Collections Automatically Created with a Script, Looking Good with Custom Posters

6. Library Organization Wrap-Up: Be Deliberate & Organized

As a summary, to get your content properly organized with the minimum amount of friction, it's essential that you:

  • Choose the right library media type for your content, which can sometimes be counter intuitive. This means your source content needs to be properly organized, and you can't drop everything in one morass of a Plex library.
  • Organize your content by type and follow the official naming conventions for your source folders and files.
  • Figure out whether readily available scanners and agents will do the job, or if you have to handle metadata yourself. There's for instance an agent to handle Youtube downloads.
  • Set up each library's advanced settings deliberately as some of the defaults can have big consequences. This is best done when you first set up your library, though that can be edited later.
  • Use collections within and across libraries for TV remote-friendly access to categorized content.
  • Summary of the summary: RTFM, there's more to Plex than first meets the eye and it's well worth understanding what's going on beneath the hood.

7. Choosing What to Watch Next with Trakt, Moviewatch

7.1. Keep Track of Watch Status and Wishlists with Trakt Integration

One of the primary criteria to choose something to watch is to filter out content you've already watched. Plex does keep track of that, but if you ever have to reset your library, that status is gone. Do you want to manually recheck hundreds of series and movies? If not, Trakt.tv gives you a way to effectively back up your watched status to a third-party service, as well as help you discover other content you might like. There's built-in "scrobber" integration between Plex Pass and Trakt VIP, but that's two subscriptions you need to keep paying. If you have a bunch of distinct Plex and Trakt users, that's the way to go.

In my case, I just have one master Plex account and one Trakt account, so here's what I ended up doing to get the most out of the Plex-Trakt combo:

  1. Install the Trakt.tv (for Plex) plugin via the Applications section of the Unofficial App Store (UAS) in Web.Tools. Contrarily to popular belief, Plex plugins are not entirely dead, I'll get back to that in a minute.
  2. Install Kitana.
  3. Do an initial full sync via Kitana (unless your Trakt account is brand new). Now Plex and Trakt should agree with each other on what you've already watched then stay that way as you watch new content.
  4. Create private watchlists in Trakt to add interesting TV shows and movies as I'm browsing that site.
  5. Connect these watchlists to Sonarr v3 and Radarr to automate their downloading.
    • I found that I had to nudge Sonarr into processing a new list which is easy enough via its API.
    • Radarr will only handle your watchlist via the "Trakt User" list option, "Trakt List" won't work for some reason.
  6. With the Web to Plex browser extension you'll see whether you have a movie/show in your server while browsing Trakt or Imdb.

Find out more about the *arr automation apps in this post. To do the above prior to Sonarr/Radarr v3 you had to use Traktarr.

In summary:

  • Content watched in Plex will automatically be marked as watched in Trakt.
  • Whenever you watch something outside of Plex, just flag it in Trakt and Plex will know.
  • Trakt watchlists are a good way to funnel content back into your Plex libraries if you're willing to set up the *arr infrastructure (again see my NAS entry, this is such a powerful stack).

A side benefit is that I was able to resync my Plex and Trakt accounts that had grown out of sync.

The only thing that I was able to do via Kodi that I can't do in Plex itself is the ability to rate content right after I watched it in the media player. Looks like that's not possible via a Plex plugin.

7.2. Make Movie Night Fun Again with Moviewatch

A common refrain from people with large libraries is that it takes them forever to find something to watch as they're overwhelmed by the sheer amount of choice they have. You can play with filters to narrow down options, but a very first-world solution to this first-world problem is Moviewatch, which gives you and your co-watchers a Tinder-like interface to swap through movie posters until there's an agreement from all parties, at which point you're one click away from launching the consensus movie in Plex.

8. Managing & Extending Plex Beyond the UI: Plugins, Maintenance, Data Analysis

8.1. Plugins: Unsupported But Not Dead

While plugins such as Web.Tools are no longer supported in the Plex UI, they still work in practice. As I just mentioned, one big piece of functionality they allow is free bidirectional integration with Trakt.

As a complement, Kitana provides a web frontend to these plugins (how to install Kitana via Portainer) which comes handy in some cases.

8.2. Maintenance & Backups: Do It Or Else

Scheduled backups: A Good Idea ™

Plex Media Server occasionally stops for obscure reasons such as version updates. Scheduling server maintenance may save you hours of setup time if your Plex database becomes irremediably corrupted, which can happen in case of abrupt shutdowns, so it's highly recommended to put your server behind a UPS.

Restoring from a backup is very easy.

8.3. Programmatic Access For Large Scale Management

There are several ways to automate functions of the Plex server:

  • Plex-Meta-Manager is "a Python 3 script that can be continuously run using YAML configuration files to update on a schedule the metadata of the movies, shows, and collections in your libraries as well as automatically build collections". I've used it to build a variety of collections such as Movies with commentary, Oscar winners, or Imdb 250. This is a game changer if you have more than 2,000 movies like I do.

    Note that collections kind of span across libraries, even if they have different types, so you can for instance have a Star Trek collection that includes movies and TV shows.

If you use the same name for collections in different libraries, Plex will cross-reference them across libraries. Pictured here, Top Rated across the main movie library and the family movie library. You could use this to tie soundtracks to movies, or file TV series and movies in the same universe.
  • Plex-auto-genres: in the same spirit that the previous script, less involved but less powerful.
  • Gaps: "Find the missing movies in your Plex Server."
  • PlexAPI, a set of unofficial Python bindings whose goal is to "match all capabilities of the official Plex Web Client", including navigating libraries, performing library actions such as scans, remote control, and listening to notifications. A collection of scripts that use this library can be found in this Github repository.
  • Python-PlexLibrary, a "command line utility for creating and maintaining dynamic Plex libraries and playlists based on 'recipes'."
  • An API that I haven't tested yet.
  • Webhooks that require Plex Pass.
  • RPA software that captures how you interact with a website or desktop app, such as Power Automate. I'd pursue this only if all else fails, but it's an option.
Collection automatically generated with Plex Meta Manager

8.4. Querying the Plex Database for Advanced Analytics

Plex stores its data in an SQLite file, which has this schema that you can query like so. I've used this to visualize my library in Microsoft Power BI as per the screenshot below. If you're going to do this, work off a copy of the database just to be safe.

Plex data in Power BI – two of my favorite things together!

A low-tech alternative is to use ExportTools to generate a CSV.

Finally, many people use Tautulli to monitor their Plex server (I do so via a Docker container on my Synology NAS), though it's focused more on analyzing viewership than library content.

  • Getting the Most Out of Your Synology Networked Attached Storage: Did You Know It Can Do That? You'll learn how to run Plex and its friends (Sonarr, Radarr, Overseerr, Tautulli, etc.) in Docker and much more.
  • Things I Found Out the Hard Way to Get the Most of the Nvidia Shield. The Shield is an excellent Plex player and a decent entry-level Plex server.

I started a thread on Reddit mentioning this post, lots of good feedback in there that I reflected above through many iterative edits.

What Does Plex Use to Match Anime

Source: https://www.oliviertravers.com/plex-complex-libraries-ultimate-media-server/

0 Response to "What Does Plex Use to Match Anime"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel