Skip to main content
Media libraries are the foundation of Jellyfin’s content organization system. Each library represents a collection of media files of a specific type (movies, TV shows, music, etc.) that Jellyfin scans, indexes, and makes available for streaming.

Library Structure

Jellyfin organizes media into a hierarchical structure:
1

Root Folder

The AggregateFolder serves as the root container for all libraries. It aggregates all virtual folders configured by the administrator.
2

Virtual Folders

Each library is represented as a virtual folder with a specific collection type (Movies, TV Shows, Music, Books, etc.).
3

Physical Paths

Virtual folders map to one or more physical paths on disk where media files are stored.
4

Media Items

Individual files are resolved into typed items (Movie, Episode, Audio, etc.) with associated metadata.

Collection Types

Jellyfin supports several collection types, each with specialized handling:
  • Individual movie files
  • Movie folders with multiple versions/editions
  • Extras (trailers, behind-the-scenes, deleted scenes)
  • Multiple video formats

Library Manager

The LibraryManager is the central service for managing media libraries:
Emby.Server.Implementations/Library/LibraryManager.cs
The LibraryManager uses an LRU cache to improve performance when accessing frequently requested items, reducing database queries.

Media Scanning Process

When Jellyfin scans a library, it follows a multi-stage process:
1

File Discovery

The file system is traversed to discover media files based on naming conventions and file extensions.
2

Item Resolution

Resolvers determine the type of each media item (Movie, Episode, Audio, etc.).Jellyfin includes specialized resolvers:
  • MovieResolver - Identifies movie files
  • SeriesResolver - Identifies TV series folders
  • EpisodeResolver - Parses episode information from filenames
  • AudioResolver - Identifies audio tracks
3

Metadata Extraction

Metadata is extracted from:
  • Embedded tags (ID3, MP4, MKV metadata)
  • File naming patterns (episode numbers, years, etc.)
  • NFO files (Kodi-compatible XML metadata)
4

Provider Fetching

External metadata providers are queried:
  • TMDb (movies and TV shows)
  • MusicBrainz (music)
  • Open Subtitles (subtitles)
  • Local metadata providers
5

Database Persistence

Items and their metadata are saved to the database.
6

Post-Scan Tasks

Additional processing tasks run after the scan:
  • Image extraction and processing
  • Chapter image generation
  • People/actor validation

Naming Conventions

Jellyfin uses the Emby.Naming library to parse media files:

TV Show Naming

Movie Naming

Music Naming

Jellyfin supports multiple naming patterns. See the NamingOptions class for the full list of supported formats.

Library Options

Each library can be configured with specific options:
MediaBrowser.Model/Configuration/LibraryOptions.cs

Real-Time Monitoring

Jellyfin can monitor libraries for changes in real-time:
MediaBrowser.Controller/Library/ILibraryMonitor.cs
When real-time monitoring is enabled:
  • File system watchers detect new, modified, or deleted files
  • Changes are debounced to avoid excessive scanning
  • Only affected items are refreshed
Real-time monitoring can be resource-intensive on large libraries or network shares. Consider using scheduled scans for network-mounted storage.

Item Resolution

The resolution process uses a priority-based system of resolvers:
MediaBrowser.Controller/Library/ItemResolveArgs.cs
Resolvers are executed in priority order:

Metadata Providers

Metadata is fetched from multiple sources:
  • NFO files: Kodi-compatible XML metadata
  • Embedded metadata: Tags in media files
  • Image files: poster.jpg, fanart.jpg, etc.

Image Processing

Jellyfin processes and caches images for optimal delivery:
  • Primary images: Posters, covers
  • Backdrops: Background artwork
  • Logos: Transparent overlays
  • Thumbnails: Chapter images, episode stills
Images are automatically resized and cached based on client requirements to optimize bandwidth and loading times.

Library Events

The LibraryManager emits events for library changes:
These events are propagated to connected clients via WebSocket.

Next Steps

Architecture

Understand Jellyfin’s overall architecture

Users & Authentication

Learn about user management

Plugins

Extend library functionality with plugins

API Reference

Access library data via the API