discarr/docs/transcoders/ffmpeg.md
pyr0ball 12f540d072
Some checks are pending
Deploy docs to GitHub Pages / build (push) Waiting to run
Deploy docs to GitHub Pages / deploy (push) Blocked by required conditions
docs: screenshots, sanitize PII, expand hardware encode docs
- Add 4 Playwright screenshots: main UI, scanning, title mapping, mobile
- Embed screenshots in README, index.md, and quickstart.md
- Sanitize docs: replace real name/hostname (alan/strahl) with
  generic examples (mediauser/encode-box)
- ffmpeg.md: add NVENC, QSV, and VAAPI hardware acceleration sections;
  document QSV custom build requirement and jellyfin-ffmpeg workaround
2026-05-27 09:59:51 -07:00

105 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ffmpeg
ffmpeg is the default transcoder in Discarr. It handles HEVC encoding and is required for disc metadata scanning regardless of which transcoder you use for encoding.
## Requirements
- `ffmpeg` — encoder
- `ffprobe` — disc metadata scanning (required even if using HandBrake for encoding)
Both are installed by `install.sh` or bundled in the Docker image.
## Encode arguments
Control encode quality and speed with `FFMPEG_ARGS`:
```bash
# Default (CRF 22, medium preset — good quality/size balance)
FFMPEG_ARGS=-c:v libx265 -crf 22 -preset medium -c:a aac -b:a 192k
# Faster encode, slightly larger file
FFMPEG_ARGS=-c:v libx265 -crf 22 -preset fast -c:a aac -b:a 192k
# Smaller file, slower encode
FFMPEG_ARGS=-c:v libx265 -crf 24 -preset slow -c:a aac -b:a 192k
# Hardware-accelerated (NVIDIA NVENC)
FFMPEG_ARGS=-c:v hevc_nvenc -preset p4 -cq 22 -c:a aac -b:a 192k
# Keep all audio tracks (useful for multi-language discs)
FFMPEG_ARGS=-c:v libx265 -crf 22 -preset medium -c:a copy -map 0
```
!!! tip "CRF values"
Lower CRF = better quality, larger file. For HEVC (`libx265`):
| CRF | Quality | Typical use |
|---|---|---|
| 1820 | Near-lossless | Archival |
| 2224 | High quality | Standard library |
| 2628 | Good quality | Space-constrained |
## Hardware acceleration
Hardware encoding is significantly faster than software (`libx265`) but requires a supported GPU and the right ffmpeg build.
### NVIDIA NVENC
Most distro-packaged ffmpeg builds include NVENC support. Requires the NVIDIA driver (no CUDA toolkit needed at runtime).
```bash
# H.265 via NVENC
FFMPEG_ARGS=-c:v hevc_nvenc -preset p4 -cq 22 -c:a aac -b:a 192k
# Verify NVENC is available
ffmpeg -encoders | grep nvenc
```
### Intel QSV (Quick Sync Video)
!!! warning "Custom ffmpeg build required"
Most distro-packaged ffmpeg builds **do not** include QSV support — it requires `--enable-libmfx` (legacy) or `--enable-libvpl` + `--enable-qsv` (oneVPL, Intel 11th gen+) at compile time.
**Easiest option:** use `jellyfin-ffmpeg`, which ships QSV-enabled builds for Ubuntu/Debian:
```bash
# Add Jellyfin repo and install jellyfin-ffmpeg
curl -fsSL https://repo.jellyfin.org/install-debuntu.sh | sudo bash
sudo apt install jellyfin-ffmpeg7
# Then point Discarr at the jellyfin binary
FFMPEG_BIN=/usr/lib/jellyfin-ffmpeg/ffmpeg
FFPROBE_BIN=/usr/lib/jellyfin-ffmpeg/ffprobe
```
Alternatively, build ffmpeg from source with `--enable-libvpl` (see [FFmpeg compilation guide](https://trac.ffmpeg.org/wiki/CompilationGuide)).
```bash
# H.265 via QSV (requires QSV-enabled ffmpeg)
FFMPEG_ARGS=-c:v hevc_qsv -global_quality 22 -c:a aac -b:a 192k
# Verify QSV is available
ffmpeg -encoders | grep qsv
ffmpeg -hwaccels | grep qsv
```
### VAAPI (AMD/Intel on Linux)
Standard distro ffmpeg builds usually include VAAPI. Works on AMD GPUs and Intel integrated graphics.
```bash
# H.265 via VAAPI
FFMPEG_ARGS=-vaapi_device /dev/dri/renderD128 -vf 'format=nv12,hwupload' -c:v hevc_vaapi -qp 22 -c:a aac -b:a 192k
# Verify VAAPI device
ls /dev/dri/renderD*
ffmpeg -hwaccels | grep vaapi
```
### Checking what your ffmpeg supports
```bash
ffmpeg -codecs | grep hevc
ffmpeg -hwaccels
ffmpeg -encoders | grep -E "nvenc|qsv|vaapi|hevc"
```