- What This Tool Does
- Quick Start
- Features
- Requirements
- Installation Options
- Configuration
- GPU Support
- Usage Examples
- Troubleshooting
- FAQ
Generates video preview thumbnails for Plex Media Server using GPU acceleration and parallel processing. Plex's built-in preview generation is slow - this tool makes it much faster.
Preview thumbnails are the small images you see when scrubbing through videos in Plex.
Before you begin, you'll need:
- A Plex Media Server running and accessible
- Your Plex authentication token (how to get it)
- The path to your Plex config folder
Docker (easiest):
# 1. Check your GPUs
docker run --rm stevezzau/plex_generate_vid_previews:latest --list-gpus
# 2. Run with your details (using environment variables)
docker run --rm --gpus all \
-e PLEX_URL=http://localhost:32400 \
-e PLEX_TOKEN=your-token-here \
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
-v /path/to/your/plex/config:/config/plex \
-v /path/to/your/media:/media \
stevezzau/plex_generate_vid_previews:latest
# Or use CLI arguments instead (both work)
docker run --rm --gpus all \
-v /path/to/your/plex/config:/config/plex \
-v /path/to/your/media:/media \
stevezzau/plex_generate_vid_previews:latest \
--plex-url http://localhost:32400 \
--plex-token your-token-here \
--plex-config-folder /config/plex/Library/Application\ Support/Plex\ Media\ ServerPip (local install):
# 1. Install
pip install git+https://github.com/stevezau/plex_generate_vid_previews.git
# 2. Check your GPUs
plex-generate-previews --list-gpus
# 3. Run with your details
plex-generate-previews \
--plex-url http://localhost:32400 \
--plex-token your-token-here \
--plex-config-folder /path/to/your/plex/Library/Application\ Support/Plex\ Media\ Server- Multi-GPU Support: NVIDIA, AMD, Intel, and Windows GPUs
- Parallel Processing: Configurable GPU and CPU worker threads
- Hardware Acceleration: CUDA, VAAPI, and D3D11VA
- Library Filtering: Process specific Plex libraries
- Quality Control: Adjustable thumbnail quality (1-10)
- Docker Support: Pre-built images with GPU acceleration
- Command-line Interface: CLI arguments and environment variables
- Plex Media Server: Running and accessible
- FFmpeg 7.0+: For video processing and hardware acceleration
- Python 3.7+: For local installation
- Docker: For containerized deployment (optional)
| Platform | Support | Notes |
|---|---|---|
| Linux | ✅ Full | GPU + CPU support (CUDA, VAAPI, etc.) |
| Docker | ✅ Full | GPU + CPU support (Recommended) |
| macOS | ✅ Full | VideoToolbox + CPU support |
| Windows | ✅ Full | D3D11VA GPU + CPU support |
Windows GPU Support:
- ✅ D3D11VA hardware decode works with ANY GPU (NVIDIA, AMD, Intel)
- ✅ Significantly speeds up thumbnail generation (2-5x faster)
- ✅ Automatic GPU detection - just install latest drivers
⚠️ Requires FFmpeg with D3D11VA support (most builds include it)
Linux/Docker:
- NVIDIA: CUDA-compatible GPU + NVIDIA drivers
- AMD: ROCm-compatible GPU + amdgpu drivers
- Intel: VAAPI-compatible iGPU/dGPU
Windows:
- All GPUs: Works with NVIDIA, AMD, or Intel GPUs
- No additional drivers needed beyond standard Windows GPU drivers
- Uses native D3D11VA acceleration (no ROCm/CUDA runtime required)
macOS:
- Apple Silicon: Works with built-in VideoToolbox acceleration
- Intel Macs: Works with Intel iGPU via VideoToolbox
Choose the installation method that best fits your setup:
Important
Note the extra "z" in the Docker Hub URL: stevezzau/plex_generate_vid_previews
(stevezau was already taken on Docker Hub)
Quick Start:
# 1. Check available GPUs
docker run --rm stevezzau/plex_generate_vid_previews:latest --list-gpus
# 2. Run with GPU acceleration (using environment variables)
docker run --rm --gpus all \
-e PLEX_URL=http://localhost:32400 \
-e PLEX_TOKEN=your-token \
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
-v /path/to/plex/config:/config/plex \
-v /path/to/media:/media \
stevezzau/plex_generate_vid_previews:latest
# 3. Alternative: using CLI arguments (environment variables and CLI arguments both work)
docker run --rm --gpus all \
-v /path/to/plex/config:/config/plex \
-v /path/to/media:/media \
stevezzau/plex_generate_vid_previews:latest \
--plex-url http://localhost:32400 \
--plex-token your-token \
--plex-config-folder /config/plex/Library/Application\ Support/Plex\ Media\ ServerGPU Requirements:
- NVIDIA: Install NVIDIA Container Toolkit
- AMD/Intel: Mount
/dev/driwith--device /dev/dri:/dev/dri(see Troubleshooting if you get permission errors)
Quick Start:
# Install from GitHub
pip install git+https://github.com/stevezau/plex_generate_vid_previews.git
# Check available GPUs
plex-generate-previews --list-gpus
# Basic usage
plex-generate-previews \
--plex-url http://localhost:32400 \
--plex-token your-token \
--plex-config-folder /path/to/plex/Library/Application\ Support/Plex\ Media\ ServerPrerequisites: Install FFmpeg and MediaInfo:
Ubuntu/Debian:
sudo apt update && sudo apt install ffmpeg mediainfomacOS (with Homebrew):
brew install ffmpeg mediainfoWindows: Download from FFmpeg and MediaInfo
Usage Methods:
# Method 1: Console script (recommended)
plex-generate-previews --help
# Method 2: Python module
python -m plex_generate_previews --helpNative Windows supports GPU acceleration using D3D11VA (Direct3D 11 Video Acceleration).
GPU Requirements:
- Compatible GPU: NVIDIA, AMD, or Intel
- Latest GPU drivers installed
- FFmpeg with D3D11VA support (included in most builds)
Basic Windows usage with GPU:
# Install
pip install git+https://github.com/stevezau/plex_generate_vid_previews.git
# Run with GPU acceleration (default)
plex-generate-previews ^
--plex-url http://localhost:32400 ^
--plex-token your-token-here ^
--plex-config-folder "C:\Users\YourName\AppData\Local\Plex Media Server" ^
--gpu-threads 4 ^
--cpu-threads 2
# Run CPU-only (if no GPU or drivers)
plex-generate-previews ^
--plex-url http://localhost:32400 ^
--plex-token your-token-here ^
--plex-config-folder "C:\Users\YourName\AppData\Local\Plex Media Server" ^
--gpu-threads 0 ^
--cpu-threads 4Important Windows Notes:
- ✅ GPU support works with any modern GPU (NVIDIA, AMD, Intel)
- ✅ D3D11VA provides hardware video decode acceleration
- ✅ 2-5x faster than CPU-only processing
⚠️ Update GPU drivers for best performance- 💡 Use
--list-gpusto verify GPU detection
This guide is for Unraid users following the TRaSH Guide folder structure with the linuxserver/plex Docker image.
Setup Steps:
-
Configure Plex Container Paths:
- Add a second container path:
/server/media/plex/ - Map to host path:
/mnt/user/media/plex/
- Add a second container path:
-
Update Plex Library Mappings:
- Delete existing library path mappings in Plex
- Add new mappings with format:
//server/media/plex/<media-folder> - Example:
//server/media/plex/tv
-
Configure Environment Variables:
PLEX_URL=http://localhost:32400 PLEX_TOKEN=your-plex-token PLEX_CONFIG_FOLDER=/config/plex/Library/Application Support/Plex Media Server
-
Set Permissions:
chmod -R 777 /mnt/cache/appdata/plex/Library/Application\ Support/Plex\ Media\ Server/Media/
-
Run the Script:
- The script may appear frozen initially but will start processing
- Check the temporary folder for generated thumbnails
You can configure using either command-line arguments or environment variables. CLI arguments take precedence over environment variables.
Required settings:
PLEX_URL- Your Plex server URL (e.g., http://localhost:32400)PLEX_TOKEN- Your Plex authentication tokenPLEX_CONFIG_FOLDER- Path to Plex config folder
Common settings:
GPU_THREADS- Number of GPU worker threads (default: 4)CPU_THREADS- Number of CPU worker threads (default: 4)THUMBNAIL_QUALITY- Preview quality 1-10 (default: 4)PLEX_LIBRARIES- Specific libraries to process (default: all)
# Basic usage
plex-generate-previews --plex-url http://localhost:32400 --plex-token YOUR_TOKEN
# With custom settings
plex-generate-previews \
--plex-url http://localhost:32400 \
--plex-token YOUR_TOKEN \
--plex-config-folder /path/to/plex/config \
--gpu-threads 8 \
--cpu-threads 4 \
--thumbnail-quality 2Create a .env file for persistent settings:
PLEX_URL=http://localhost:32400
PLEX_TOKEN=your-token-here
PLEX_CONFIG_FOLDER=/path/to/plex/config
GPU_THREADS=4
CPU_THREADS=4
THUMBNAIL_QUALITY=4For detailed configuration options, see the complete reference tables below:
| Variable | CLI Argument | Description | Default |
|---|---|---|---|
PLEX_URL |
--plex-url |
Plex server URL | Required |
PLEX_TOKEN |
--plex-token |
Plex authentication token | Required |
PLEX_CONFIG_FOLDER |
--plex-config-folder |
Path to Plex config folder | Required |
PLEX_TIMEOUT |
--plex-timeout |
Plex API timeout in seconds | 60 |
PLEX_LIBRARIES |
--plex-libraries |
Comma-separated library names | All libraries |
GPU_THREADS |
--gpu-threads |
Number of GPU worker threads (0-32) | 4 |
CPU_THREADS |
--cpu-threads |
Number of CPU worker threads (0-32) | 4 |
GPU_SELECTION |
--gpu-selection |
GPU selection: "all" or "0,1,2" | "all" |
THUMBNAIL_QUALITY |
--thumbnail-quality |
Preview quality 1-10 (2=highest, 10=lowest) | 4 |
PLEX_BIF_FRAME_INTERVAL |
--plex-bif-frame-interval |
Interval between preview images (1-60 seconds) | 5 |
REGENERATE_THUMBNAILS |
--regenerate-thumbnails |
Regenerate existing thumbnails | false |
TMP_FOLDER |
--tmp-folder |
Temporary folder for processing | System temp dir |
LOG_LEVEL |
--log-level |
Logging level (DEBUG, INFO, WARNING, ERROR) | INFO |
PUID |
N/A | User ID to run container as (Docker only) | 1000 |
PGID |
N/A | Group ID to run container as (Docker only) | 1000 |
Note: PUID/PGID let you run the container as your host user (prevents file permission issues). Defaults to 1000. For GPU access, you may also need --group-add (see Troubleshooting).
| Command | Description |
|---|---|
--list-gpus |
List detected GPUs and exit |
--help |
Show help message and exit |
Path mappings are crucial when running in Docker or when Plex and the tool see different file paths. This is one of the most common issues users encounter.
What are Path Mappings? Path mappings tell the tool how to convert Plex's file paths to the actual file paths accessible within the container or on the remote machine.
The Problem:
- Plex stores file paths like:
/server/media/movies/avatar.mkv - Inside Docker container, files are at:
/media/movies/avatar.mkv - The tool needs to know how to convert between these paths
When You Need Path Mappings:
- Running in Docker with volume mounts
- Plex running on a different machine than the tool
- Different path structures between Plex and the tool
- Using network shares or mounted drives
How to Use Path Mappings:
Using the Avatar example from above:
# Plex sees: /server/media/movies/avatar.mkv
# Container sees: /media/movies/avatar.mkv
# Solution: Map /server/media to /media
--plex-videos-path-mapping "/server/media" \
--plex-local-videos-path-mapping "/media"Common Examples:
Example 1: Docker with Volume Mounts
# Plex sees: /server/media/movies/avatar.mkv
# Container sees: /media/movies/avatar.mkv
docker run --rm --gpus all \
-e PLEX_URL=http://localhost:32400 \
-e PLEX_TOKEN=your-token \
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
-v /path/to/plex/config:/config/plex \
-v /path/to/media:/media \
stevezzau/plex_generate_vid_previews:latest \
--plex-videos-path-mapping "/server/media" \
--plex-local-videos-path-mapping "/media"Example 2: Different Server Names
# Plex sees: /mnt/media/movies/avatar.mkv
# Container sees: /media/movies/avatar.mkv
--plex-videos-path-mapping "/mnt/media" \
--plex-local-videos-path-mapping "/media"Example 3: Windows Network Shares
# Plex sees: \\server\media\movies\avatar.mkv
# Container sees: /media/movies/avatar.mkv
--plex-videos-path-mapping "\\\\server\\media" \
--plex-local-videos-path-mapping "/media"Example 4: Multiple Path Mappings
# If you have multiple different path structures
--plex-videos-path-mapping "/server/media,/mnt/media" \
--plex-local-videos-path-mapping "/media,/media"How to Find Your Path Mappings:
-
Check Plex Library Settings:
- Go to Plex Web → Settings → Libraries
- Click on a library → Edit → Folders
- Note the path Plex shows (e.g.,
/server/media/movies)
-
Check Your Docker Volume Mounts:
# Your Docker command should have something like: -v /host/path/to/media:/container/path/to/media -
Test the Mapping:
# Run with debug logging to see path conversions plex-generate-previews --log-level DEBUG \ --plex-videos-path-mapping "/server/media" \ --plex-local-videos-path-mapping "/media"
Troubleshooting Path Mappings:
Problem: "Skipping as file not found"
- Cause: Incorrect path mappings
- Solution: Check that the mapping correctly converts Plex paths to accessible paths
Problem: "Permission denied"
- Cause: Container can't access the mapped path
- Solution: Check Docker volume mount permissions and user mapping
Problem: "No videos found"
- Cause: Path mapping doesn't match any Plex library paths
- Solution: Verify Plex library paths match your mapping
Quick Test:
# Test if your paths are correct
docker run --rm -v /your/media:/media stevezzau/plex_generate_vid_previews:latest \
--list-gpus --plex-videos-path-mapping "/server/media" \
--plex-local-videos-path-mapping "/media"Pro Tips:
- Always use absolute paths
- Test with
--log-level DEBUGto see path conversions - Check Plex library settings to see exact paths
- Use forward slashes even on Windows
- Escape backslashes in Windows paths:
\\\\server\\share
The tool automatically detects and supports multiple GPU types with hardware acceleration:
| GPU Type | Platform | Acceleration | Requirements | Docker Support |
|---|---|---|---|---|
| NVIDIA | Linux | CUDA | NVIDIA drivers + CUDA toolkit | ✅ NVIDIA Container Toolkit |
| AMD | Linux | VAAPI | amdgpu drivers + ROCm | ✅ ROCm Docker support |
| Intel | Linux | VAAPI | Intel drivers + VA-API | ✅ Device access |
| All GPUs | Windows | D3D11VA | Latest GPU drivers (no ROCm/CUDA runtime) | ❌ Native Windows only |
| Apple Silicon | macOS | VideoToolbox | macOS with FFmpeg + mediainfo | ❌ Native macOS only |
The tool automatically detects available GPUs and their capabilities:
# List all detected GPUs
plex-generate-previews --list-gpus
# Example output:
# ✅ Found 2 GPU(s):
# [0] NVIDIA GeForce RTX 4090 (CUDA)
# [1] Intel UHD Graphics 770 (VAAPI - /dev/dri/renderD128)Configure GPU usage with the --gpu-selection parameter:
# Use all detected GPUs (default)
plex-generate-previews --gpu-selection all
# Use specific GPUs by index
plex-generate-previews --gpu-selection "0,2"
# Use only the first GPU
plex-generate-previews --gpu-selection "0"Linux:
- NVIDIA: Uses CUDA for maximum performance
- AMD: Uses VAAPI with ROCm drivers
- Intel: Uses VAAPI (Video Acceleration API)
Windows:
- All GPUs (NVIDIA/AMD/Intel): Uses D3D11VA (DirectX 11 Video Acceleration) - no ROCm or CUDA runtime required
macOS:
- Apple Silicon: Uses VideoToolbox (M1/M2/M3/M4 chips)
Install the NVIDIA Container Toolkit on your host system.
Follow the ROCm Docker setup guide for container GPU access.
Ensure the container has access to /dev/dri devices and the render group:
services:
previews:
user: 1000:1000
group_add:
- 109 # render group GID
devices:
- /dev/dri:/dev/driWarning
Do NOT use init: true in your compose file! This container uses LinuxServer.io's s6-overlay which is a more capable init system. Adding init: true will cause errors and disable important features like PUID/PGID support. See docker-compose.example.yml for a complete working example.
NVIDIA GPU:
version: '3.8'
services:
previews:
image: stevezzau/plex_generate_vid_previews:latest
user: 1000:1000
environment:
- PLEX_URL=http://localhost:32400
- PLEX_TOKEN=your-plex-token
- PLEX_CONFIG_FOLDER=/config/plex/Library/Application Support/Plex Media Server
volumes:
- /path/to/plex/config:/config/plex
- /path/to/media:/media
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
runtime: nvidiaAMD GPU:
version: '3.8'
services:
previews:
image: stevezzau/plex_generate_vid_previews:latest
user: 1000:1000
environment:
- PLEX_URL=http://localhost:32400
- PLEX_TOKEN=your-plex-token
- PLEX_CONFIG_FOLDER=/config/plex/Library/Application Support/Plex Media Server
volumes:
- /path/to/plex/config:/config/plex
- /path/to/media:/media
devices:
- /dev/dri:/dev/dri
group_add:
- 109 # render groupNote: Docker supports both environment variables (shown below) and CLI arguments. To use CLI arguments, append them after the image name (e.g.,
stevezzau/plex_generate_vid_previews:latest --plex-url http://... --plex-token ...). See Quick Start for CLI argument examples.
NVIDIA GPU:
docker run --rm --gpus all \
-e PLEX_URL=http://localhost:32400 \
-e PLEX_TOKEN=your-token \
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
-v /path/to/plex/config:/config/plex \
-v /path/to/media:/media \
stevezzau/plex_generate_vid_previews:latestAMD GPU:
docker run --rm \
--device=/dev/dri:/dev/dri \
--group-add 109 \
-e PLEX_URL=http://localhost:32400 \
-e PLEX_TOKEN=your-token \
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
-v /path/to/plex/config:/config/plex \
-v /path/to/media:/media \
stevezzau/plex_generate_vid_previews:latestProcess specific libraries:
plex-generate-previews \
--plex-url http://localhost:32400 \
--plex-token your-token \
--plex-config-folder /path/to/plex/config \
--plex-libraries "Movies, TV Shows"Use specific GPUs:
plex-generate-previews \
--plex-url http://localhost:32400 \
--plex-token your-token \
--plex-config-folder /path/to/plex/config \
--gpu-selection "0,2" \
--gpu-threads 8CPU-only processing:
plex-generate-previews \
--plex-url http://localhost:32400 \
--plex-token your-token \
--plex-config-folder /path/to/plex/config \
--gpu-threads 0 \
--cpu-threads 8- Cause: You have
init: truein your docker-compose.yml or using--initwith docker run - Why this breaks: This container uses s6-overlay (LinuxServer.io base) as its init system. Docker's init conflicts with it.
- What you lose with
init: true:- ❌ PUID/PGID support (file permissions will be wrong)
- ❌ Process supervision
- ❌ Proper initialization
- Solution:
- Docker Compose: Remove
init: truefrom your compose file - Docker CLI: Remove the
--initflag - s6-overlay is MORE capable than Docker's basic init - you don't need both!
- Docker Compose: Remove
- Example: See
docker-compose.example.ymlfor correct configuration
- Cause: GPU drivers not installed or FFmpeg doesn't support hardware acceleration
- Solution:
- Install proper GPU drivers
- Update FFmpeg to version 7.0+
- Use
--list-gpusto check detection - Fall back to CPU-only:
--gpu-threads 0 --cpu-threads 4
- Cause: The container needs to run as a user that has GPU device permissions
- Solution: Set
PUIDandPGIDenvironment variables on the container - The error message tells you what values to use - look for your user ID in the output
- Example:
docker run -e PUID=1000 -e PGID=1000 --device /dev/dri:/dev/dri ...
- Cause: Incorrect path to Plex Media Server configuration folder
- Solution:
- Verify the path exists:
ls -la "/path/to/plex/Library/Application Support/Plex Media Server" - Check for proper Plex folder structure (Cache, Media folders)
- Use absolute paths, not relative paths
- Verify the path exists:
- Cause: Insufficient permissions to access files or directories
- Solution:
- Check file ownership:
ls -la /path/to/plex/config - Fix permissions:
chmod -R 755 /path/to/plex/config - For Docker: ensure proper user/group mapping
- Check file ownership:
- Cause: Plex server not accessible or incorrect credentials
- Solution:
- Verify Plex URL is correct and accessible
- Check Plex token is valid and not expired
- Test connection:
curl -H "X-Plex-Token: YOUR_TOKEN" http://localhost:32400/status/sessions
- Cause: Missing GPU runtime or device access
- Solution:
- NVIDIA: Install NVIDIA Container Toolkit
- AMD: Add
--device=/dev/dri:/dev/dri --group-add 109 - Intel: Add
--device=/dev/dri:/dev/dri --group-add 109 - Test with:
docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
- Cause: Incorrect path mappings or missing media files
- Solution:
- Verify media file paths are correct
- Check path mappings in Plex settings
- For Windows mapped drives, use UNC paths:
\\server\share\path
- Cause: GPU not detected or drivers not installed
- Solution:
- Install latest GPU drivers (NVIDIA, AMD, or Intel)
- Verify GPU is working in Windows Device Manager
- Test with:
plex-generate-previews --list-gpus - If needed, use CPU-only:
--gpu-threads 0 --cpu-threads 4
Enable debug logging for detailed troubleshooting:
plex-generate-previews --log-level DEBUG- Check the GitHub Issues
- Enable debug logging and check logs
- Verify your configuration with
--help - Test GPU detection with
--list-gpus
Q: What's new in version 2.0.0? A: Version 2.0.0 introduces multi-GPU support, improved CLI interface, better error handling, and a complete rewrite with modern Python practices.
Q: Does this work on Windows? A: Yes! Windows fully supports GPU acceleration via D3D11VA, which works with NVIDIA, AMD, and Intel GPUs. Install the latest GPU drivers and the tool will automatically detect and use your GPU for faster processing.
Q: Can I use this without a GPU?
A: Yes! Set --gpu-threads 0 and use --cpu-threads 4 (or higher) for CPU-only processing.
Q: How do I know which GPUs are detected?
A: Run plex-generate-previews --list-gpus to see all detected GPUs and their capabilities.
Q: Can I process specific libraries only?
A: Yes! Use --plex-libraries "Movies, TV Shows" to process only specific Plex libraries.
Q: What's the difference between thumbnail quality 1-10? A: Lower numbers = higher quality but larger file sizes. Quality 2 is highest quality, quality 10 is lowest quality.
Q: How many threads should I use? A: Start with 4 GPU threads and 4 CPU threads. Adjust based on your hardware - more threads = faster processing but higher resource usage.
Q: Can I use multiple GPUs?
A: Yes! The tool automatically detects and can use multiple GPUs. Use --gpu-selection "0,1,2" to select specific GPUs.
Q: "Skipping as file not found" error? A: This usually means incorrect path mappings. Check your Docker volume mounts or Plex library path mappings.
Q: Docker GPU not working? A: Ensure you have the proper GPU runtime installed (NVIDIA Container Toolkit, ROCm, etc.) and correct device access.
Q: How do I enable debug logging?
A: Use --log-level DEBUG or set LOG_LEVEL=DEBUG in your environment.
- GitHub Issues: Report bugs or request features
- Documentation: This README and inline help (
--help) - Community: Check existing issues for solutions to common problems
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.