Files
nexus/wiki/concepts/硬件转码.md

54 lines
2.3 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.
---
title: "硬件转码"
type: concept
tags: [video, transcoding, hardware, jellyfin, performance]
date: 2026-04-14
---
# 硬件转码
通过 GPU 或专用硬件(而非 CPU 软件计算)加速视频编解码的过程。
## Core Mechanism
- 视频转码:将一种编码格式(如 H.265)转换为另一种(如 H.264)以适配不同客户端
- 软件转码:完全依赖 CPU 执行计算密集CPU 占用高
- 硬件转码:将编码计算卸载到 GPU/专用硬件单元CPU 占用极低,速度快
## 常见硬件转码方案
| 方案 | 硬件 | 接口 | 常见应用 |
|------|------|------|----------|
| Intel QuickSync | Intel CPU 集成 GPU | /dev/dri | Jellyfin、FFmpeg |
| NVIDIA NVENC | NVIDIA 独立/移动 GPU | nvidia-container-toolkit | Jellyfin、Plex、FFmpeg |
| AMD VCE | AMD GPU | /dev/dri (DRI3) | FFmpeg |
| VA-API | 通用 Linux 视频加速 API | /dev/dri | FFmpeg、mpv |
| Apple VideoToolbox | Apple Silicon / Intel Mac | 框架调用 | macOS 原生应用 |
## Jellyfin 中的硬件转码
```yaml
devices:
- /dev/dri:/dev/dri # Intel QuickSync / VA-API
```
- 群晖 NAS 优先使用 QuickSync / VA-API 降低 CPU 占用
- nyanmisaka/jellyfin 镜像预装优化 FFmpeg开箱即用 QuickSync
- 内存建议 2-4GB 以应对转码缓冲需求
## 性能对比(参考值)
| 方式 | 1080p H.265→H.264 转码1小时 | CPU 占用 |
|------|-----------------------------------|----------|
| 软件转码x264 | ~45 分钟 | 100%(多核) |
| Intel QuickSync | ~8 分钟 | ~15% |
| NVIDIA NVENC | ~5 分钟 | ~20% |
## Related Concepts
- [[设备直通]] — 将宿主机硬件设备映射到容器内使用,是硬件转码在 Docker 环境的前提
- [[软件转码]] — 无硬件加速时的 CPU 纯软件转码方案
- [[转码缓存]] — Jellyfin/Navidrome 中缓存已转码文件以避免重复转码
## Connections
- [[Jellyfin]] ← 应用场景 ← [[硬件转码]] — 媒体服务器转码加速
- [[Navidrome]] ← 应用场景 ← [[硬件转码]] — 音乐转码(音频转码)
- [[群晖 NAS]] ← 部署环境 ← [[硬件转码]] — Synology Intel CPU 支持 QuickSync
## Sources
- [[用docker安装jellyfin]] — 群晖 NAS 上 Jellyfin QuickSync 硬件转码配置