Installation
Media Viewer can be deployed using Docker (recommended) or built from source with Go.
Docker Installation
Docker is the recommended installation method as it handles all dependencies automatically.
Image Selection
Two image variants are available:
ghcr.io/djryanj/media-viewer:latest- Alpine-based, supports Intel/AMD VA-API GPU accelerationghcr.io/djryanj/media-viewer:latest-nvidia- Debian-based, supports NVIDIA NVENC GPU acceleration
For GPU support details, see the GPU Support Guide.
Using Docker Compose
Create a docker-compose.yml file:
version: '3.8'
services:
media-viewer:
image: ghcr.io/djryanj/media-viewer:latest # Use :latest-nvidia for NVIDIA GPUs
container_name: media-viewer
ports:
- '8080:8080'
- '9090:9090'
volumes:
- /path/to/your/media:/media:ro
- media-cache:/cache
- media-database:/database
environment:
- MEDIA_DIR=/media
- CACHE_DIR=/cache
- DATABASE_DIR=/database
- PORT=8080
- METRICS_PORT=9090
- METRICS_ENABLED=true
- INDEX_INTERVAL=30m
- SESSION_DURATION=24h
- MEMORY_RATIO=0.75 # Recommended: Adaptive GC
# - GOGC=150 # Alternative for non-containerized deployments
restart: unless-stopped
volumes:
media-cache:
media-database:
Start the application:
Using Docker Run
docker run -d \
--name media-viewer \
-p 8080:8080 \
-p 9090:9090 \
-v /path/to/your/media:/media:ro \
-v media-cache:/cache \
-v media-database:/database \
ghcr.io/djryanj/media-viewer:latest
GPU-Accelerated Transcoding (Optional)
For significantly faster video transcoding, you can enable GPU acceleration:
NVIDIA GPU
Important: Use the NVIDIA-optimized image for NVIDIA GPU support.
Add GPU support to docker-compose.yml:
services:
media-viewer:
image: ghcr.io/djryanj/media-viewer:latest-nvidia # Use NVIDIA image
runtime: nvidia # Use NVIDIA runtime
environment:
- GPU_ACCEL=nvidia
- MEMORY_RATIO=0.75 # Recommended: Adaptive GC
# - GOGC=150 # Alternative for non-containerized deployments
# ... rest of configuration
Or with docker run:
docker run -d \
--gpus all \
-e GPU_ACCEL=nvidia \
-p 8080:8080 \
-v /path/to/media:/media:ro \
ghcr.io/djryanj/media-viewer:latest-nvidia
Requirements:
- NVIDIA GPU with NVENC support
- NVIDIA Container Toolkit installed on host
- Use
:latest-nvidiaor:v1.0.0-nvidiaimage tags (Debian-based)
Intel/AMD GPU (VA-API)
Add device mapping to docker-compose.yml:
services:
media-viewer:
image: ghcr.io/djryanj/media-viewer:latest
devices:
- /dev/dri:/dev/dri
environment:
- GPU_ACCEL=vaapi
- MEMORY_RATIO=0.75 # Recommended: Adaptive GC
# - GOGC=150 # Alternative for non-containerized deployments
# ... rest of configuration
Or with docker run:
docker run -d \
--device /dev/dri:/dev/dri \
-e GPU_ACCEL=vaapi \
... \
ghcr.io/djryanj/media-viewer:latest
Requirements: Intel or AMD GPU with VA-API support, /dev/dri device available
Performance
GPU transcoding provides 2-5x faster video processing with lower CPU usage, especially beneficial for:
- 4K/8K video transcoding
- Multiple concurrent transcode operations
- Systems with limited CPU capacity
If GPU is unavailable or fails, the system automatically falls back to CPU transcoding.
Building from Source
For development or custom deployments:
Prerequisites
- Go 1.21 or later
- FFmpeg
- GCC (for SQLite CGO compilation)
- Node.js 18+ (for frontend development tools only)
Steps
-
Clone the repository:
-
Build the application:
-
(Optional) Build the password reset utility:
-
Configure environment variables (see Configuration)
-
Start the server:
Initial Setup
On first run, Media Viewer will prompt you to create a password:
- Access the application at
http://localhost:8080 - You'll be redirected to the setup page
- Create a secure password (minimum 6 characters)
- Click Create Password
- You'll be automatically logged in
Verifying Installation
Once running, access Media Viewer at http://localhost:8080 (or your configured port). You should see either:
- The setup page (first time) - create your password
- The login page (subsequent runs) - enter your password