plexclip
A Rust CLI tool to download videos from Plex Media Server with support for direct downloads and HLS transcoding.
Issues can be reported at https://todo.sr.ht/~jacky/plexclip.
Features
- Direct Downloads: Download original media files without transcoding
- HLS Transcoding: Server-side transcoding with configurable quality/bitrate
- Time Range Selection: Download specific segments of videos
- Interactive Selection: Browse and select media from your Plex library
- Multiple Formats: Support for MP4, MKV, TS, and more
- Shell Completions: Auto-generated bash/zsh completions
Installation
From Source
The binary will be at target/release/plexclip.
Pre-built Binaries
Download the latest release from the Releases page.
Quick Start
1. Configure Authentication
Interactive Terminal Input (Recommended)
# Interactive terminal input for token and server
Manual Token Input
# Add your Plex server and token
Help with Token Acquisition
# Get interactive help for obtaining your Plex token
2. Download a Video
# Interactive selection (browse your library)
# Download by rating key
# Download by Plex Web URL
3. Download with Time Range
# Download from 1 minute to 2 minutes 30 seconds
# Download first 5 minutes
4. Open After Download
# Download and open with default player
Commands
Download
Download videos from Plex Media Server:
)
)
)
)
)
)
Info
Display information about a media item:
Auth
Manage authentication:
# Interactive terminal token input (recommended)
# Set token manually
# Show current configuration
Servers
List configured servers:
Supported URL Formats
- Rating Key:
12345 - Library Path:
/library/metadata/12345 - Plex Web URL:
https://app.plex.tv/desktop#!/server/abc.../details?key=/library/metadata/12345
Finding Your Plex ID (Rating Key)
From app.plex.tv: When you click on a movie or episode in the Plex web app, look at the URL:
https://app.plex.tv/desktop#!/server/abc123/details?key=/library/metadata/12345
^^^^^^^
The number after /metadata/ is your Plex ID (rating key).
From your own Plex server (e.g., plex.example.com):
https://plex.example.com/web/details?key=/library/metadata/12345
^^^^^^^
The number after /metadata/ is your Plex ID (rating key).
You can then use:
How It Works
Direct Downloads
For supported media, plexclip downloads the original file directly using HTTP Range requests for resume support.
HLS Transcoding
For time ranges or when direct access isn't available:
- Starts a transcode session with Plex Media Server
- Downloads HLS segments concurrently
- Concatenates segments using ffmpeg
- Verifies output with ffprobe
Requirements
- ffmpeg and ffprobe must be installed for HLS transcoding
Configuration
Config file: ~/.config/plexclip/config.toml
[]
= "your-plex-token-here"
# OR use command substitution (recommended for sensitive tokens)
= { = "pass show plex/token" }
# token = { cmd = "cat ~/.plexpass" }
# token = { cmd = "secret-tool lookup plex token" }
[[]]
= "home"
= "http://localhost:32400"
= true
[]
= "mp4"
= "1920x1080"
= 8000 # kbps
= 75 # 0-100
Command Substitution for Tokens
You can use command substitution to load sensitive values from external commands like password managers:
[]
# Execute a command to get the token
= { = "pass show plex/token" }
Examples:
- pass:
token = { cmd = "pass show plex/token" } - password-store:
token = { cmd = "cat ~/.plexpass" } - secret-tool:
token = { cmd = "secret-tool lookup plex token" } - any shell command:
token = { cmd = "your-command-here" }
The command's stdout (first line, trimmed) will be used as the token.
You cannot specify both token and token_cmd in the same config.
Troubleshooting
Authentication Issues
# Verify token is valid
# If you get "Authentication required", check:
# 1. Token is correct
# 2. Server URL is reachable
# 3. Plex server allows downloads
Transcode Issues
# Ensure ffmpeg is installed
# Try direct download if transcoding fails
# Use debug mode to see full server response
Development
Setup
Testing
# Run all tests
# Run with coverage
Code Style
# Format code
# Lint
CI/CD
Project uses builds.sr.ht for continuous integration and automated releases. See .builds.yml for configuration.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option. See LICENSE-APACHE or LICENSE-MIT for details.
Security
This tool downloads content you have legal access to through your Plex Media Server. Please ensure you have proper rights to any content you download.