plex-generate-previews 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plex_generate_previews-2.0.0/PKG-INFO +728 -0
- plex_generate_previews-2.0.0/README.md +692 -0
- plex_generate_previews-2.0.0/plex_generate_previews/__init__.py +10 -0
- plex_generate_previews-2.0.0/plex_generate_previews/__main__.py +11 -0
- plex_generate_previews-2.0.0/plex_generate_previews/cli.py +474 -0
- plex_generate_previews-2.0.0/plex_generate_previews/config.py +479 -0
- plex_generate_previews-2.0.0/plex_generate_previews/gpu_detection.py +541 -0
- plex_generate_previews-2.0.0/plex_generate_previews/media_processing.py +439 -0
- plex_generate_previews-2.0.0/plex_generate_previews/plex_client.py +211 -0
- plex_generate_previews-2.0.0/plex_generate_previews/utils.py +135 -0
- plex_generate_previews-2.0.0/plex_generate_previews/version_check.py +178 -0
- plex_generate_previews-2.0.0/plex_generate_previews/worker.py +478 -0
- plex_generate_previews-2.0.0/plex_generate_previews.egg-info/PKG-INFO +728 -0
- plex_generate_previews-2.0.0/plex_generate_previews.egg-info/SOURCES.txt +21 -0
- plex_generate_previews-2.0.0/plex_generate_previews.egg-info/dependency_links.txt +1 -0
- plex_generate_previews-2.0.0/plex_generate_previews.egg-info/entry_points.txt +2 -0
- plex_generate_previews-2.0.0/plex_generate_previews.egg-info/requires.txt +14 -0
- plex_generate_previews-2.0.0/plex_generate_previews.egg-info/top_level.txt +1 -0
- plex_generate_previews-2.0.0/pyproject.toml +54 -0
- plex_generate_previews-2.0.0/setup.cfg +4 -0
- plex_generate_previews-2.0.0/tests/test_basic.py +159 -0
- plex_generate_previews-2.0.0/tests/test_cli.py +116 -0
- plex_generate_previews-2.0.0/tests/test_gpu_ci.py +76 -0
@@ -0,0 +1,728 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: plex-generate-previews
|
3
|
+
Version: 2.0.0
|
4
|
+
Summary: Generate video preview thumbnails for Plex Media Server
|
5
|
+
Author-email: stevezau <stevezau@example.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/stevezau/plex_generate_vid_previews
|
8
|
+
Project-URL: Repository, https://github.com/stevezau/plex_generate_vid_previews
|
9
|
+
Project-URL: Issues, https://github.com/stevezau/plex_generate_vid_previews/issues
|
10
|
+
Keywords: plex,media,server,video,thumbnails,previews,ffmpeg,gpu,acceleration
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
20
|
+
Classifier: Topic :: Multimedia :: Video
|
21
|
+
Classifier: Topic :: System :: Archiving
|
22
|
+
Requires-Python: >=3.7
|
23
|
+
Description-Content-Type: text/markdown
|
24
|
+
Requires-Dist: requests==2.32.3
|
25
|
+
Requires-Dist: urllib3>=1.26.0
|
26
|
+
Requires-Dist: python-dotenv==1.1.1
|
27
|
+
Requires-Dist: plexapi==4.17.1
|
28
|
+
Requires-Dist: loguru==0.7.3
|
29
|
+
Requires-Dist: rich==13.8.1
|
30
|
+
Requires-Dist: pymediainfo==6.1.0
|
31
|
+
Requires-Dist: psutil>=5.9.0
|
32
|
+
Provides-Extra: nvidia
|
33
|
+
Requires-Dist: pynvml==11.6.0; extra == "nvidia"
|
34
|
+
Provides-Extra: amd
|
35
|
+
Requires-Dist: amdsmi==6.2.1; extra == "amd"
|
36
|
+
|
37
|
+
# [stevezau/plex_generate_vid_previews](https://github.com/stevezau/plex_generate_vid_previews/)
|
38
|
+
|
39
|
+
[](https://github.com/stevezau/plex_generate_vid_previews)
|
40
|
+
[](https://python.org)
|
41
|
+
[](LICENSE)
|
42
|
+
[](https://hub.docker.com/repository/docker/stevezzau/plex_generate_vid_previews)
|
43
|
+
|
44
|
+
## Table of Contents
|
45
|
+
|
46
|
+
- [What This Tool Does](#what-this-tool-does)
|
47
|
+
- [Quick Start](#quick-start)
|
48
|
+
- [Features](#features)
|
49
|
+
- [Requirements](#requirements)
|
50
|
+
- [Installation Options](#installation-options)
|
51
|
+
- [Docker](#docker)
|
52
|
+
- [Pip Installation](#pip-installation)
|
53
|
+
- [Unraid](#unraid)
|
54
|
+
- [Configuration](#configuration)
|
55
|
+
- [Command-line Arguments](#command-line-arguments)
|
56
|
+
- [Environment Variables](#environment-variables)
|
57
|
+
- [GPU Support](#gpu-support)
|
58
|
+
- [Usage Examples](#usage-examples)
|
59
|
+
- [Troubleshooting](#troubleshooting)
|
60
|
+
- [FAQ](#faq)
|
61
|
+
|
62
|
+
## What This Tool Does
|
63
|
+
|
64
|
+
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.
|
65
|
+
|
66
|
+
Preview thumbnails are the small images you see when scrubbing through videos in Plex.
|
67
|
+
|
68
|
+
## Quick Start
|
69
|
+
|
70
|
+
**Before you begin, you'll need:**
|
71
|
+
1. A Plex Media Server running and accessible
|
72
|
+
2. Your Plex authentication token ([how to get it](https://support.plex.tv/articles/204059436/))
|
73
|
+
3. The path to your Plex config folder
|
74
|
+
|
75
|
+
**Docker (easiest):**
|
76
|
+
```bash
|
77
|
+
# 1. Check your GPUs
|
78
|
+
docker run --rm stevezzau/plex_generate_vid_previews:latest --list-gpus
|
79
|
+
|
80
|
+
# 2. Run with your details
|
81
|
+
docker run --rm --gpus all \
|
82
|
+
-e PLEX_URL=http://localhost:32400 \
|
83
|
+
-e PLEX_TOKEN=your-token-here \
|
84
|
+
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
|
85
|
+
-v /path/to/your/plex/config:/config/plex \
|
86
|
+
-v /path/to/your/media:/media \
|
87
|
+
stevezzau/plex_generate_vid_previews:latest
|
88
|
+
```
|
89
|
+
|
90
|
+
**Pip (local install):**
|
91
|
+
```bash
|
92
|
+
# 1. Install
|
93
|
+
pip install git+https://github.com/stevezau/plex_generate_vid_previews.git
|
94
|
+
|
95
|
+
# 2. Check your GPUs
|
96
|
+
plex-generate-previews --list-gpus
|
97
|
+
|
98
|
+
# 3. Run with your details
|
99
|
+
plex-generate-previews \
|
100
|
+
--plex-url http://localhost:32400 \
|
101
|
+
--plex-token your-token-here \
|
102
|
+
--plex-config-folder /path/to/your/plex/Library/Application\ Support/Plex\ Media\ Server
|
103
|
+
```
|
104
|
+
|
105
|
+
## Features
|
106
|
+
|
107
|
+
- **Multi-GPU Support**: NVIDIA, AMD, Intel, and WSL2 GPUs
|
108
|
+
- **Parallel Processing**: Configurable GPU and CPU worker threads
|
109
|
+
- **Hardware Acceleration**: CUDA, VAAPI, QSV, and D3D11VA
|
110
|
+
- **Library Filtering**: Process specific Plex libraries
|
111
|
+
- **Quality Control**: Adjustable thumbnail quality (1-10)
|
112
|
+
- **Docker Support**: Pre-built images with GPU acceleration
|
113
|
+
- **Command-line Interface**: CLI arguments and environment variables
|
114
|
+
|
115
|
+
## Requirements
|
116
|
+
|
117
|
+
- **Plex Media Server**: Running and accessible
|
118
|
+
- **FFmpeg 7.0+**: For video processing and hardware acceleration
|
119
|
+
- **Python 3.7+**: For local installation
|
120
|
+
- **Docker**: For containerized deployment (optional)
|
121
|
+
|
122
|
+
### GPU Requirements
|
123
|
+
- **NVIDIA**: CUDA-compatible GPU + NVIDIA drivers
|
124
|
+
- **AMD**: ROCm-compatible GPU + amdgpu drivers
|
125
|
+
- **Intel**: QSV or VAAPI-compatible iGPU/dGPU
|
126
|
+
- **WSL2**: D3D11VA-compatible GPU (Intel Arc, etc.)
|
127
|
+
|
128
|
+
## Installation Options
|
129
|
+
|
130
|
+
Choose the installation method that best fits your setup:
|
131
|
+
|
132
|
+
### Docker (Recommended)
|
133
|
+
|
134
|
+
> [!IMPORTANT]
|
135
|
+
> Note the extra "z" in the Docker Hub URL: [stevezzau/plex_generate_vid_previews](https://hub.docker.com/repository/docker/stevezzau/plex_generate_vid_previews)
|
136
|
+
> (stevezau was already taken on Docker Hub)
|
137
|
+
|
138
|
+
**Quick Start:**
|
139
|
+
```bash
|
140
|
+
# 1. Check available GPUs
|
141
|
+
docker run --rm stevezzau/plex_generate_vid_previews:latest --list-gpus
|
142
|
+
|
143
|
+
# 2. Run with GPU acceleration
|
144
|
+
docker run --rm --gpus all \
|
145
|
+
-e PLEX_URL=http://localhost:32400 \
|
146
|
+
-e PLEX_TOKEN=your-token \
|
147
|
+
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
|
148
|
+
-v /path/to/plex/config:/config/plex \
|
149
|
+
-v /path/to/media:/media \
|
150
|
+
stevezzau/plex_generate_vid_previews:latest
|
151
|
+
```
|
152
|
+
|
153
|
+
**GPU Requirements:**
|
154
|
+
- **NVIDIA**: Install [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html)
|
155
|
+
- **AMD**: Follow [ROCm Docker setup guide](https://rocm.docs.amd.com/en/docs-5.0.2/deploy/docker.html)
|
156
|
+
- **Intel**: Ensure container has access to `/dev/dri` devices and render group
|
157
|
+
- **WSL2**: No special configuration needed - automatically detects WSL2 GPUs
|
158
|
+
|
159
|
+
### Pip Installation
|
160
|
+
|
161
|
+
**Quick Start:**
|
162
|
+
```bash
|
163
|
+
# Install from GitHub
|
164
|
+
pip install git+https://github.com/stevezau/plex_generate_vid_previews.git
|
165
|
+
|
166
|
+
# Check available GPUs
|
167
|
+
plex-generate-previews --list-gpus
|
168
|
+
|
169
|
+
# Basic usage
|
170
|
+
plex-generate-previews \
|
171
|
+
--plex-url http://localhost:32400 \
|
172
|
+
--plex-token your-token \
|
173
|
+
--plex-config-folder /path/to/plex/Library/Application\ Support/Plex\ Media\ Server
|
174
|
+
```
|
175
|
+
|
176
|
+
**Prerequisites:**
|
177
|
+
Install FFmpeg and MediaInfo:
|
178
|
+
|
179
|
+
**Ubuntu/Debian:**
|
180
|
+
```bash
|
181
|
+
sudo apt update && sudo apt install ffmpeg mediainfo
|
182
|
+
```
|
183
|
+
|
184
|
+
**macOS (with Homebrew):**
|
185
|
+
```bash
|
186
|
+
brew install ffmpeg mediainfo
|
187
|
+
```
|
188
|
+
|
189
|
+
**Windows:**
|
190
|
+
Download from [FFmpeg](https://ffmpeg.org/download.html) and [MediaInfo](https://mediaarea.net/en/MediaInfo/Download)
|
191
|
+
|
192
|
+
**Usage Methods:**
|
193
|
+
```bash
|
194
|
+
# Method 1: Console script (recommended)
|
195
|
+
plex-generate-previews --help
|
196
|
+
|
197
|
+
# Method 2: Python module
|
198
|
+
python -m plex_generate_previews --help
|
199
|
+
```
|
200
|
+
|
201
|
+
### Unraid
|
202
|
+
|
203
|
+
This guide is for Unraid users following the [TRaSH Guide](https://trash-guides.info/) folder structure with the linuxserver/plex Docker image.
|
204
|
+
|
205
|
+
**Setup Steps:**
|
206
|
+
1. **Configure Plex Container Paths:**
|
207
|
+
- Add a second container path: `/server/media/plex/`
|
208
|
+
- Map to host path: `/mnt/user/media/plex/`
|
209
|
+
|
210
|
+
2. **Update Plex Library Mappings:**
|
211
|
+
- Delete existing library path mappings in Plex
|
212
|
+
- Add new mappings with format: `//server/media/plex/<media-folder>`
|
213
|
+
- Example: `//server/media/plex/tv`
|
214
|
+
|
215
|
+
3. **Configure Environment Variables:**
|
216
|
+
```bash
|
217
|
+
PLEX_URL=http://localhost:32400
|
218
|
+
PLEX_TOKEN=your-plex-token
|
219
|
+
PLEX_CONFIG_FOLDER=/config/plex/Library/Application Support/Plex Media Server
|
220
|
+
```
|
221
|
+
|
222
|
+
4. **Set Permissions:**
|
223
|
+
```bash
|
224
|
+
chmod -R 777 /mnt/cache/appdata/plex/Library/Application\ Support/Plex\ Media\ Server/Media/
|
225
|
+
```
|
226
|
+
|
227
|
+
5. **Run the Script:**
|
228
|
+
- The script may appear frozen initially but will start processing
|
229
|
+
- Check the temporary folder for generated thumbnails
|
230
|
+
|
231
|
+
## Configuration
|
232
|
+
|
233
|
+
You can configure using either **command-line arguments** or **environment variables**. CLI arguments take precedence over environment variables.
|
234
|
+
|
235
|
+
### Basic Configuration
|
236
|
+
|
237
|
+
**Required settings:**
|
238
|
+
- `PLEX_URL` - Your Plex server URL (e.g., http://localhost:32400)
|
239
|
+
- `PLEX_TOKEN` - Your Plex authentication token
|
240
|
+
- `PLEX_CONFIG_FOLDER` - Path to Plex config folder
|
241
|
+
|
242
|
+
**Common settings:**
|
243
|
+
- `GPU_THREADS` - Number of GPU worker threads (default: 4)
|
244
|
+
- `CPU_THREADS` - Number of CPU worker threads (default: 4)
|
245
|
+
- `THUMBNAIL_QUALITY` - Preview quality 1-10 (default: 4)
|
246
|
+
- `PLEX_LIBRARIES` - Specific libraries to process (default: all)
|
247
|
+
|
248
|
+
### Command-line Arguments
|
249
|
+
|
250
|
+
```bash
|
251
|
+
# Basic usage
|
252
|
+
plex-generate-previews --plex-url http://localhost:32400 --plex-token YOUR_TOKEN
|
253
|
+
|
254
|
+
# With custom settings
|
255
|
+
plex-generate-previews \
|
256
|
+
--plex-url http://localhost:32400 \
|
257
|
+
--plex-token YOUR_TOKEN \
|
258
|
+
--plex-config-folder /path/to/plex/config \
|
259
|
+
--gpu-threads 8 \
|
260
|
+
--cpu-threads 4 \
|
261
|
+
--thumbnail-quality 2
|
262
|
+
```
|
263
|
+
|
264
|
+
### Environment Variables
|
265
|
+
|
266
|
+
Create a `.env` file for persistent settings:
|
267
|
+
|
268
|
+
```bash
|
269
|
+
PLEX_URL=http://localhost:32400
|
270
|
+
PLEX_TOKEN=your-token-here
|
271
|
+
PLEX_CONFIG_FOLDER=/path/to/plex/config
|
272
|
+
GPU_THREADS=4
|
273
|
+
CPU_THREADS=4
|
274
|
+
THUMBNAIL_QUALITY=4
|
275
|
+
```
|
276
|
+
|
277
|
+
### Advanced Configuration
|
278
|
+
|
279
|
+
For detailed configuration options, see the complete reference tables below:
|
280
|
+
|
281
|
+
#### All Configuration Options
|
282
|
+
|
283
|
+
| Variable | CLI Argument | Description | Default |
|
284
|
+
|----------|--------------|-------------|---------|
|
285
|
+
| `PLEX_URL` | `--plex-url` | Plex server URL | *Required* |
|
286
|
+
| `PLEX_TOKEN` | `--plex-token` | Plex authentication token | *Required* |
|
287
|
+
| `PLEX_CONFIG_FOLDER` | `--plex-config-folder` | Path to Plex config folder | *Required* |
|
288
|
+
| `PLEX_TIMEOUT` | `--plex-timeout` | Plex API timeout in seconds | 60 |
|
289
|
+
| `PLEX_LIBRARIES` | `--plex-libraries` | Comma-separated library names | All libraries |
|
290
|
+
| `GPU_THREADS` | `--gpu-threads` | Number of GPU worker threads (0-32) | 4 |
|
291
|
+
| `CPU_THREADS` | `--cpu-threads` | Number of CPU worker threads (0-32) | 4 |
|
292
|
+
| `GPU_SELECTION` | `--gpu-selection` | GPU selection: "all" or "0,1,2" | "all" |
|
293
|
+
| `THUMBNAIL_QUALITY` | `--thumbnail-quality` | Preview quality 1-10 (2=highest, 10=lowest) | 4 |
|
294
|
+
| `PLEX_BIF_FRAME_INTERVAL` | `--plex-bif-frame-interval` | Interval between preview images (1-60 seconds) | 5 |
|
295
|
+
| `REGENERATE_THUMBNAILS` | `--regenerate-thumbnails` | Regenerate existing thumbnails | false |
|
296
|
+
| `TMP_FOLDER` | `--tmp-folder` | Temporary folder for processing | /tmp/plex_generate_previews |
|
297
|
+
| `LOG_LEVEL` | `--log-level` | Logging level (DEBUG, INFO, WARNING, ERROR) | INFO |
|
298
|
+
|
299
|
+
#### Special Commands
|
300
|
+
|
301
|
+
| Command | Description |
|
302
|
+
|---------|-------------|
|
303
|
+
| `--list-gpus` | List detected GPUs and exit |
|
304
|
+
| `--help` | Show help message and exit |
|
305
|
+
|
306
|
+
#### Path Mappings (Docker/Remote)
|
307
|
+
|
308
|
+
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.
|
309
|
+
|
310
|
+
**What are Path Mappings?**
|
311
|
+
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.
|
312
|
+
|
313
|
+
**The Problem:**
|
314
|
+
- Plex stores file paths like: `/server/media/movies/avatar.mkv`
|
315
|
+
- Inside Docker container, files are at: `/media/movies/avatar.mkv`
|
316
|
+
- The tool needs to know how to convert between these paths
|
317
|
+
|
318
|
+
**When You Need Path Mappings:**
|
319
|
+
- Running in Docker with volume mounts
|
320
|
+
- Plex running on a different machine than the tool
|
321
|
+
- Different path structures between Plex and the tool
|
322
|
+
- Using network shares or mounted drives
|
323
|
+
|
324
|
+
**How to Use Path Mappings:**
|
325
|
+
|
326
|
+
Using the Avatar example from above:
|
327
|
+
```bash
|
328
|
+
# Plex sees: /server/media/movies/avatar.mkv
|
329
|
+
# Container sees: /media/movies/avatar.mkv
|
330
|
+
# Solution: Map /server/media to /media
|
331
|
+
--plex-videos-path-mapping "/server/media" \
|
332
|
+
--plex-local-videos-path-mapping "/media"
|
333
|
+
```
|
334
|
+
|
335
|
+
**Common Examples:**
|
336
|
+
|
337
|
+
**Example 1: Docker with Volume Mounts**
|
338
|
+
```bash
|
339
|
+
# Plex sees: /server/media/movies/avatar.mkv
|
340
|
+
# Container sees: /media/movies/avatar.mkv
|
341
|
+
docker run --rm --gpus all \
|
342
|
+
-e PLEX_URL=http://localhost:32400 \
|
343
|
+
-e PLEX_TOKEN=your-token \
|
344
|
+
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
|
345
|
+
-v /path/to/plex/config:/config/plex \
|
346
|
+
-v /path/to/media:/media \
|
347
|
+
stevezzau/plex_generate_vid_previews:latest \
|
348
|
+
--plex-videos-path-mapping "/server/media" \
|
349
|
+
--plex-local-videos-path-mapping "/media"
|
350
|
+
```
|
351
|
+
|
352
|
+
**Example 2: Different Server Names**
|
353
|
+
```bash
|
354
|
+
# Plex sees: /mnt/media/movies/avatar.mkv
|
355
|
+
# Container sees: /media/movies/avatar.mkv
|
356
|
+
--plex-videos-path-mapping "/mnt/media" \
|
357
|
+
--plex-local-videos-path-mapping "/media"
|
358
|
+
```
|
359
|
+
|
360
|
+
**Example 3: Windows Network Shares**
|
361
|
+
```bash
|
362
|
+
# Plex sees: \\server\media\movies\avatar.mkv
|
363
|
+
# Container sees: /media/movies/avatar.mkv
|
364
|
+
--plex-videos-path-mapping "\\\\server\\media" \
|
365
|
+
--plex-local-videos-path-mapping "/media"
|
366
|
+
```
|
367
|
+
|
368
|
+
**Example 4: Multiple Path Mappings**
|
369
|
+
```bash
|
370
|
+
# If you have multiple different path structures
|
371
|
+
--plex-videos-path-mapping "/server/media,/mnt/media" \
|
372
|
+
--plex-local-videos-path-mapping "/media,/media"
|
373
|
+
```
|
374
|
+
|
375
|
+
**How to Find Your Path Mappings:**
|
376
|
+
|
377
|
+
1. **Check Plex Library Settings:**
|
378
|
+
- Go to Plex Web → Settings → Libraries
|
379
|
+
- Click on a library → Edit → Folders
|
380
|
+
- Note the path Plex shows (e.g., `/server/media/movies`)
|
381
|
+
|
382
|
+
2. **Check Your Docker Volume Mounts:**
|
383
|
+
```bash
|
384
|
+
# Your Docker command should have something like:
|
385
|
+
-v /host/path/to/media:/container/path/to/media
|
386
|
+
```
|
387
|
+
|
388
|
+
3. **Test the Mapping:**
|
389
|
+
```bash
|
390
|
+
# Run with debug logging to see path conversions
|
391
|
+
plex-generate-previews --log-level DEBUG \
|
392
|
+
--plex-videos-path-mapping "/server/media" \
|
393
|
+
--plex-local-videos-path-mapping "/media"
|
394
|
+
```
|
395
|
+
|
396
|
+
**Troubleshooting Path Mappings:**
|
397
|
+
|
398
|
+
**Problem: "Skipping as file not found"**
|
399
|
+
- **Cause**: Incorrect path mappings
|
400
|
+
- **Solution**: Check that the mapping correctly converts Plex paths to accessible paths
|
401
|
+
|
402
|
+
**Problem: "Permission denied"**
|
403
|
+
- **Cause**: Container can't access the mapped path
|
404
|
+
- **Solution**: Check Docker volume mount permissions and user mapping
|
405
|
+
|
406
|
+
**Problem: "No videos found"**
|
407
|
+
- **Cause**: Path mapping doesn't match any Plex library paths
|
408
|
+
- **Solution**: Verify Plex library paths match your mapping
|
409
|
+
|
410
|
+
**Quick Test:**
|
411
|
+
```bash
|
412
|
+
# Test if your paths are correct
|
413
|
+
docker run --rm -v /your/media:/media stevezzau/plex_generate_vid_previews:latest \
|
414
|
+
--list-gpus --plex-videos-path-mapping "/server/media" \
|
415
|
+
--plex-local-videos-path-mapping "/media"
|
416
|
+
```
|
417
|
+
|
418
|
+
**Pro Tips:**
|
419
|
+
- Always use absolute paths
|
420
|
+
- Test with `--log-level DEBUG` to see path conversions
|
421
|
+
- Check Plex library settings to see exact paths
|
422
|
+
- Use forward slashes even on Windows
|
423
|
+
- Escape backslashes in Windows paths: `\\\\server\\share`
|
424
|
+
|
425
|
+
## GPU Support
|
426
|
+
|
427
|
+
The tool automatically detects and supports multiple GPU types with hardware acceleration:
|
428
|
+
|
429
|
+
### Supported GPU Types
|
430
|
+
|
431
|
+
| GPU Type | Acceleration | Requirements | Docker Support |
|
432
|
+
|----------|--------------|--------------|----------------|
|
433
|
+
| **NVIDIA** | CUDA | NVIDIA drivers + CUDA toolkit | ✅ NVIDIA Container Toolkit |
|
434
|
+
| **AMD** | VAAPI | amdgpu drivers + ROCm | ✅ ROCm Docker support |
|
435
|
+
| **Intel** | QSV/VAAPI | Intel drivers + Media SDK | ✅ Device access |
|
436
|
+
| **WSL2** | D3D11VA | WSL2 + compatible GPU | ✅ Native WSL2 |
|
437
|
+
|
438
|
+
### GPU Detection
|
439
|
+
|
440
|
+
The tool automatically detects available GPUs and their capabilities:
|
441
|
+
|
442
|
+
```bash
|
443
|
+
# List all detected GPUs
|
444
|
+
plex-generate-previews --list-gpus
|
445
|
+
|
446
|
+
# Example output:
|
447
|
+
# ✅ Found 2 GPU(s):
|
448
|
+
# [0] NVIDIA GeForce RTX 4090 (CUDA)
|
449
|
+
# [1] Intel UHD Graphics 770 (QSV)
|
450
|
+
```
|
451
|
+
|
452
|
+
### Multi-GPU Support
|
453
|
+
|
454
|
+
Configure GPU usage with the `--gpu-selection` parameter:
|
455
|
+
|
456
|
+
```bash
|
457
|
+
# Use all detected GPUs (default)
|
458
|
+
plex-generate-previews --gpu-selection all
|
459
|
+
|
460
|
+
# Use specific GPUs by index
|
461
|
+
plex-generate-previews --gpu-selection "0,2"
|
462
|
+
|
463
|
+
# Use only the first GPU
|
464
|
+
plex-generate-previews --gpu-selection "0"
|
465
|
+
```
|
466
|
+
|
467
|
+
### Hardware Acceleration Methods
|
468
|
+
|
469
|
+
- **NVIDIA**: Uses CUDA for maximum performance
|
470
|
+
- **AMD**: Uses VAAPI with ROCm drivers
|
471
|
+
- **Intel**: Uses QSV (Quick Sync Video) or VAAPI
|
472
|
+
- **WSL2**: Uses D3D11VA for Windows GPU passthrough
|
473
|
+
|
474
|
+
### Docker GPU Requirements
|
475
|
+
|
476
|
+
#### NVIDIA
|
477
|
+
Install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) on your host system.
|
478
|
+
|
479
|
+
#### AMD
|
480
|
+
Follow the [ROCm Docker setup guide](https://rocm.docs.amd.com/en/docs-5.0.2/deploy/docker.html) for container GPU access.
|
481
|
+
|
482
|
+
#### Intel
|
483
|
+
Ensure the container has access to `/dev/dri` devices and the render group:
|
484
|
+
|
485
|
+
```yaml
|
486
|
+
services:
|
487
|
+
previews:
|
488
|
+
user: 1000:1000
|
489
|
+
group_add:
|
490
|
+
- 109 # render group GID
|
491
|
+
devices:
|
492
|
+
- /dev/dri:/dev/dri
|
493
|
+
```
|
494
|
+
|
495
|
+
#### WSL2
|
496
|
+
No special Docker configuration needed - automatically detects WSL2 GPUs.
|
497
|
+
|
498
|
+
## Usage Examples
|
499
|
+
|
500
|
+
### Docker Compose Examples
|
501
|
+
|
502
|
+
**NVIDIA GPU:**
|
503
|
+
```yaml
|
504
|
+
version: '3.8'
|
505
|
+
services:
|
506
|
+
previews:
|
507
|
+
image: stevezzau/plex_generate_vid_previews:latest
|
508
|
+
user: 1000:1000
|
509
|
+
environment:
|
510
|
+
- PLEX_URL=http://localhost:32400
|
511
|
+
- PLEX_TOKEN=your-plex-token
|
512
|
+
- PLEX_CONFIG_FOLDER=/config/plex/Library/Application Support/Plex Media Server
|
513
|
+
volumes:
|
514
|
+
- /path/to/plex/config:/config/plex
|
515
|
+
- /path/to/media:/media
|
516
|
+
deploy:
|
517
|
+
resources:
|
518
|
+
reservations:
|
519
|
+
devices:
|
520
|
+
- capabilities: [gpu]
|
521
|
+
runtime: nvidia
|
522
|
+
```
|
523
|
+
|
524
|
+
**AMD GPU:**
|
525
|
+
```yaml
|
526
|
+
version: '3.8'
|
527
|
+
services:
|
528
|
+
previews:
|
529
|
+
image: stevezzau/plex_generate_vid_previews:latest
|
530
|
+
user: 1000:1000
|
531
|
+
environment:
|
532
|
+
- PLEX_URL=http://localhost:32400
|
533
|
+
- PLEX_TOKEN=your-plex-token
|
534
|
+
- PLEX_CONFIG_FOLDER=/config/plex/Library/Application Support/Plex Media Server
|
535
|
+
volumes:
|
536
|
+
- /path/to/plex/config:/config/plex
|
537
|
+
- /path/to/media:/media
|
538
|
+
devices:
|
539
|
+
- /dev/dri:/dev/dri
|
540
|
+
group_add:
|
541
|
+
- 109 # render group
|
542
|
+
```
|
543
|
+
|
544
|
+
### Docker CLI Examples
|
545
|
+
|
546
|
+
**NVIDIA GPU:**
|
547
|
+
```bash
|
548
|
+
docker run --rm --gpus all \
|
549
|
+
-e PLEX_URL=http://localhost:32400 \
|
550
|
+
-e PLEX_TOKEN=your-token \
|
551
|
+
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
|
552
|
+
-v /path/to/plex/config:/config/plex \
|
553
|
+
-v /path/to/media:/media \
|
554
|
+
stevezzau/plex_generate_vid_previews:latest
|
555
|
+
```
|
556
|
+
|
557
|
+
**AMD GPU:**
|
558
|
+
```bash
|
559
|
+
docker run --rm \
|
560
|
+
--device=/dev/dri:/dev/dri \
|
561
|
+
--group-add 109 \
|
562
|
+
-e PLEX_URL=http://localhost:32400 \
|
563
|
+
-e PLEX_TOKEN=your-token \
|
564
|
+
-e PLEX_CONFIG_FOLDER=/config/plex/Library/Application\ Support/Plex\ Media\ Server \
|
565
|
+
-v /path/to/plex/config:/config/plex \
|
566
|
+
-v /path/to/media:/media \
|
567
|
+
stevezzau/plex_generate_vid_previews:latest
|
568
|
+
```
|
569
|
+
|
570
|
+
### Advanced Usage
|
571
|
+
|
572
|
+
**Process specific libraries:**
|
573
|
+
```bash
|
574
|
+
plex-generate-previews \
|
575
|
+
--plex-url http://localhost:32400 \
|
576
|
+
--plex-token your-token \
|
577
|
+
--plex-config-folder /path/to/plex/config \
|
578
|
+
--plex-libraries "Movies, TV Shows"
|
579
|
+
```
|
580
|
+
|
581
|
+
**Use specific GPUs:**
|
582
|
+
```bash
|
583
|
+
plex-generate-previews \
|
584
|
+
--plex-url http://localhost:32400 \
|
585
|
+
--plex-token your-token \
|
586
|
+
--plex-config-folder /path/to/plex/config \
|
587
|
+
--gpu-selection "0,2" \
|
588
|
+
--gpu-threads 8
|
589
|
+
```
|
590
|
+
|
591
|
+
**CPU-only processing:**
|
592
|
+
```bash
|
593
|
+
plex-generate-previews \
|
594
|
+
--plex-url http://localhost:32400 \
|
595
|
+
--plex-token your-token \
|
596
|
+
--plex-config-folder /path/to/plex/config \
|
597
|
+
--gpu-threads 0 \
|
598
|
+
--cpu-threads 8
|
599
|
+
```
|
600
|
+
|
601
|
+
## Troubleshooting
|
602
|
+
|
603
|
+
### Common Issues
|
604
|
+
|
605
|
+
#### "No GPUs detected"
|
606
|
+
- **Cause**: GPU drivers not installed or FFmpeg doesn't support hardware acceleration
|
607
|
+
- **Solution**:
|
608
|
+
- Install proper GPU drivers
|
609
|
+
- Update FFmpeg to version 7.0+
|
610
|
+
- Use `--list-gpus` to check detection
|
611
|
+
- Fall back to CPU-only: `--gpu-threads 0 --cpu-threads 4`
|
612
|
+
|
613
|
+
#### "PLEX_CONFIG_FOLDER does not exist"
|
614
|
+
- **Cause**: Incorrect path to Plex Media Server configuration folder
|
615
|
+
- **Solution**:
|
616
|
+
- Verify the path exists: `ls -la "/path/to/plex/Library/Application Support/Plex Media Server"`
|
617
|
+
- Check for proper Plex folder structure (Cache, Media folders)
|
618
|
+
- Use absolute paths, not relative paths
|
619
|
+
|
620
|
+
#### "Permission denied" errors
|
621
|
+
- **Cause**: Insufficient permissions to access files or directories
|
622
|
+
- **Solution**:
|
623
|
+
- Check file ownership: `ls -la /path/to/plex/config`
|
624
|
+
- Fix permissions: `chmod -R 755 /path/to/plex/config`
|
625
|
+
- For Docker: ensure proper user/group mapping
|
626
|
+
|
627
|
+
#### "Connection failed" to Plex
|
628
|
+
- **Cause**: Plex server not accessible or incorrect credentials
|
629
|
+
- **Solution**:
|
630
|
+
- Verify Plex URL is correct and accessible
|
631
|
+
- Check Plex token is valid and not expired
|
632
|
+
- Test connection: `curl -H "X-Plex-Token: YOUR_TOKEN" http://localhost:32400/status/sessions`
|
633
|
+
|
634
|
+
#### Docker GPU not working
|
635
|
+
- **Cause**: Missing GPU runtime or device access
|
636
|
+
- **Solution**:
|
637
|
+
- **NVIDIA**: Install NVIDIA Container Toolkit
|
638
|
+
- **AMD**: Add `--device=/dev/dri:/dev/dri --group-add 109`
|
639
|
+
- **Intel**: Add `--device=/dev/dri:/dev/dri --group-add 109`
|
640
|
+
- Test with: `docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi`
|
641
|
+
|
642
|
+
#### "Skipping as file not found"
|
643
|
+
- **Cause**: Incorrect path mappings or missing media files
|
644
|
+
- **Solution**:
|
645
|
+
- Verify media file paths are correct
|
646
|
+
- Check path mappings in Plex settings
|
647
|
+
- For Windows mapped drives, use UNC paths: `\\server\share\path`
|
648
|
+
|
649
|
+
### Debug Mode
|
650
|
+
|
651
|
+
Enable debug logging for detailed troubleshooting:
|
652
|
+
|
653
|
+
```bash
|
654
|
+
plex-generate-previews --log-level DEBUG
|
655
|
+
```
|
656
|
+
|
657
|
+
### Getting Help
|
658
|
+
|
659
|
+
1. Check the [GitHub Issues](https://github.com/stevezau/plex_generate_vid_previews/issues)
|
660
|
+
2. Enable debug logging and check logs
|
661
|
+
3. Verify your configuration with `--help`
|
662
|
+
4. Test GPU detection with `--list-gpus`
|
663
|
+
|
664
|
+
|
665
|
+
## FAQ
|
666
|
+
|
667
|
+
### General Questions
|
668
|
+
|
669
|
+
**Q: What's new in version 2.0.0?**
|
670
|
+
A: Version 2.0.0 introduces multi-GPU support, improved CLI interface, better error handling, WSL2 support, and a complete rewrite with modern Python practices.
|
671
|
+
|
672
|
+
**Q: Can I use this without a GPU?**
|
673
|
+
A: Yes! Set `--gpu-threads 0` and use `--cpu-threads 4` (or higher) for CPU-only processing.
|
674
|
+
|
675
|
+
**Q: How do I know which GPUs are detected?**
|
676
|
+
A: Run `plex-generate-previews --list-gpus` to see all detected GPUs and their capabilities.
|
677
|
+
|
678
|
+
**Q: Can I process specific libraries only?**
|
679
|
+
A: Yes! Use `--plex-libraries "Movies, TV Shows"` to process only specific Plex libraries.
|
680
|
+
|
681
|
+
**Q: What's the difference between thumbnail quality 1-10?**
|
682
|
+
A: Lower numbers = higher quality but larger file sizes. Quality 2 is highest quality, quality 10 is lowest quality.
|
683
|
+
|
684
|
+
### Performance Questions
|
685
|
+
|
686
|
+
**Q: How many threads should I use?**
|
687
|
+
A: Start with 4 GPU threads and 4 CPU threads. Adjust based on your hardware - more threads = faster processing but higher resource usage.
|
688
|
+
|
689
|
+
**Q: Can I use multiple GPUs?**
|
690
|
+
A: Yes! The tool automatically detects and can use multiple GPUs. Use `--gpu-selection "0,1,2"` to select specific GPUs.
|
691
|
+
|
692
|
+
### Troubleshooting Questions
|
693
|
+
|
694
|
+
**Q: "Skipping as file not found" error?**
|
695
|
+
A: This usually means incorrect path mappings. Check your Docker volume mounts or Plex library path mappings.
|
696
|
+
|
697
|
+
**Q: Docker GPU not working?**
|
698
|
+
A: Ensure you have the proper GPU runtime installed (NVIDIA Container Toolkit, ROCm, etc.) and correct device access.
|
699
|
+
|
700
|
+
**Q: How do I enable debug logging?**
|
701
|
+
A: Use `--log-level DEBUG` or set `LOG_LEVEL=DEBUG` in your environment.
|
702
|
+
|
703
|
+
## Support
|
704
|
+
|
705
|
+
- **GitHub Issues**: [Report bugs or request features](https://github.com/stevezau/plex_generate_vid_previews/issues)
|
706
|
+
- **Documentation**: This README and inline help (`--help`)
|
707
|
+
- **Community**: Check existing issues for solutions to common problems
|
708
|
+
|
709
|
+
## Contributing
|
710
|
+
|
711
|
+
We welcome contributions! Please:
|
712
|
+
|
713
|
+
1. Fork the repository
|
714
|
+
2. Create a feature branch
|
715
|
+
3. Make your changes
|
716
|
+
4. Add tests if applicable
|
717
|
+
5. Submit a pull request
|
718
|
+
|
719
|
+
## License
|
720
|
+
|
721
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
722
|
+
|
723
|
+
## Acknowledgments
|
724
|
+
|
725
|
+
- [Plex](https://www.plex.tv/) for the amazing media server
|
726
|
+
- [FFmpeg](https://ffmpeg.org/) for video processing capabilities
|
727
|
+
- [Rich](https://github.com/Textualize/rich) for beautiful terminal output
|
728
|
+
- All contributors and users who help improve this project
|