Migrate Plex to Jellyfin Without Losing Watch History
In this article
This guide walks you through moving your Plex media library to Jellyfin while preserving your watch history, ratings, and play progress. The key is to export your Plex data, convert it into a format Jellyfin understands, and import it after setting up your new server. You'll need access to both Plex and Jellyfin servers, a computer with Python installed, and a bit of patience. No metadata (posters, artwork) is migrated—only watch state and user ratings.
What You'll Need
- A running Plex Media Server with your library and watch history intact.
- A running Jellyfin server (can be on the same or different machine).
- Python 3.6+ installed on a machine that can access both servers.
- Plex API token (find it in Plex Web: Settings > Server > General > Advanced, or in the Plex log file).
- Jellyfin API key (create one in Jellyfin Dashboard > API Keys).
- Optional: A text editor for editing scripts.
Step-by-Step
- Back up your Plex database (optional but recommended). Stop Plex Media Server and copy the entire Plex data directory (usually
%LOCALAPPDATA%\Plex Media Serveron Windows,/var/lib/plexmediaserveron Linux, or~/Library/Application Support/Plex Media Serveron macOS). This is your safety net. - Install the export tool. Download the
plex-jellyfin-syncscript from a trusted source (e.g., GitHub). Alternatively, use a community tool likeplex_to_jellyfinorjellyfin-plex-sync. For this guide, we'll use a Python script calledplex_jellyfin_migrate.py—you can find it via a web search. - Get your Plex token. In Plex Web, click your profile icon (top right) > Settings > Server > General. Scroll to 'Advanced' and copy the 'API token' (a long string of characters). Alternatively, open the Plex log file and search for
token=. - Get your Jellyfin API key. In Jellyfin Dashboard, go to 'API Keys' and click 'Create API Key'. Give it a name (e.g., 'migration') and copy the generated key.
- Run the export script. Open a terminal/command prompt and run the script with your Plex details. Example command:
python plex_jellyfin_migrate.py --plex-url http://localhost:32400 --plex-token YOUR_PLEX_TOKEN --export export.json
This creates a JSON file containing all your watched items, ratings, and timestamps. - Prepare your Jellyfin library. Before importing, ensure your Jellyfin library is set up with the same media files (same folder structure or at least same file names). Jellyfin must match items by file path or name. Ideally, use the same directory paths as Plex.
- Run the import script. Run the script again with Jellyfin parameters:
python plex_jellyfin_migrate.py --jellyfin-url http://localhost:8096 --jellyfin-token YOUR_JELLYFIN_TOKEN --import export.json
The script will find matching items in Jellyfin and mark them as watched, set your ratings, and restore play positions. - Verify the migration. Log into Jellyfin, go to a library, and check a few items that you know you watched. They should show as played with the correct progress. Also check your user profile for ratings.
- Clean up (optional). After verifying, you can delete the export.json file and the script. Keep your Plex backup for a while in case you need to revert.
Common Mistakes
- Not matching file paths. If your Jellyfin library uses different folder names or file names than Plex, the script won't find matches. Keep the same directory structure or manually adjust paths in the export file.
- Forgetting to enable 'Display movie titles' in Plex. Some scripts rely on Plex's internal IDs; if you don't have the right permissions, the export might be empty.
- Using the wrong API key. Plex tokens are sensitive—never share them. Jellyfin API keys must be created with 'Admin' permissions.
- Importing before Jellyfin finishes scanning. If the library is still scanning, items may not be in the database yet, causing the import to skip them. Wait until the library is fully scanned.
- Overwriting existing watch history. Some scripts have a '--force' flag that overwrites Jellyfin's existing data. Use it only if you want to replace everything.
Tips
- Test the migration on a small library first (e.g., one folder) to ensure the script works before running it on your whole collection.
- If you have multiple users in Plex, the script may only export the admin user's history. Check the script's documentation for multi-user support.
- For TV shows, the script usually matches by episode file path. Make sure your series folders are named consistently (e.g., 'Show Name/Season 01/Show Name S01E01.mkv').
- If you're moving to a different OS, ensure both servers are accessible from the machine running the script.
- Consider running the import during off-peak hours to avoid high CPU usage on your Jellyfin server.
Troubleshooting
- Script errors with 'ModuleNotFoundError' – Install required Python packages using
pip install requestsandpip install plexapi(or as per the script's requirements). - No items imported – Check the export.json file to see if it contains entries. If empty, your Plex token might be wrong or the script can't reach Plex. Test with a simple curl command.
- Items imported but not marked as watched – The script might be using a different user ID. In Jellyfin, ensure you're logged in as the same user you imported for. Some scripts require a '--user' parameter.
- Play progress is off by a few seconds – This is normal due to timestamp rounding. You can manually adjust in Jellyfin if needed.
- Script hangs or times out – Increase timeout values in the script or run it on the same machine as Jellyfin to reduce network latency.
- Ratings not imported – Some scripts only handle watch state. Check the script's documentation to see if ratings are supported. If not, you may need to export ratings separately using Plex's API.
Frequently Asked Questions
Will my watch history be exactly the same in Jellyfin?
Yes, for most items. The script copies the watched/unwatched state, play count, and last played date. Playback position is also copied, but it may be off by a few seconds due to rounding.
Does this work for TV shows and movies?
Yes, both are supported. The script matches episodes by file path, so ensure your TV show files are named consistently.
Can I migrate multiple users' watch history?
Some scripts support it, but not all. Check the specific script's documentation. If not, you'll need to export each user's history separately and import them into corresponding Jellyfin users.
Will my custom metadata (posters, descriptions) be transferred?
No, this migration only moves watch history and ratings. Metadata like posters, artwork, and descriptions are not transferred. Jellyfin will fetch its own metadata from the internet.
Do I need to stop Plex or Jellyfin during migration?
No, both servers can be running. The script accesses them via their APIs. However, it's best to avoid making changes to your library (adding/removing items) during the migration.
What if I have duplicate files or different qualities?
The script matches by file path, so if a file exists in both libraries with the same path, it will match. If you have different file names, you may need to manually edit the export.json to adjust paths.