fix: Исправление выбора энкодер/декодер

This commit is contained in:
2026-01-20 14:24:51 +03:00
parent 88fc443cb6
commit 69b3a4804f
15 changed files with 457 additions and 250 deletions

View File

@@ -5,7 +5,7 @@
CLI tool to convert videos to DASH and HLS with hardware acceleration (NVENC / Intel QSV / AMD AMF / VAAPI), adaptive streaming, and automatic thumbnails/poster.
**Features:**
- ⚡ Hardware acceleration: NVENC / Intel QSV / AMD AMF / VAAPI (auto priority)
- ⚡ Hardware acceleration: auto-detect encoder/decoder (NVENC / Intel QSV / AMD AMF / VAAPI / CPU)
- 🎯 Formats: DASH and HLS (shared segments)
- 📊 Quality profiles: multiple bitrates/FPS (auto or custom)
- 🖼️ Preview: thumbnail sprite + VTT, poster from the first frame
@@ -51,18 +51,19 @@ create-vod <input-video> [output-dir] [-r resolutions] [-c codec] [-f format] [-
### Options
| Option | Description | Format | Example |
|--------|----------------------------|----------------------------|---------------------------------|
| `-r, --resolutions` | Quality profiles | `360`, `720@60`, `1080-60` | `-r 720,1080,1440@60` |
| `-c, --codec` | Video codec | `h264`, `av1`, `dual` | `-c dual` (default) |
| `-f, --format` | Streaming format | `dash`, `hls`, `both` | `-f both` (default) |
| `-p, --poster` | Poster timecode | `HH:MM:SS` or seconds | `-p 00:00:05` or `-p 10` |
| `--accel` | Hardware accelerator | `auto`, `nvenc`, `qsv`, `amf`, `cpu` | `--accel nvenc` |
| Option | Description | Values / Format | Default | Example |
|--------|----------------------------|----------------------------|----------|---------------------------------|
| `-r, --resolutions` | Quality profiles | `360`, `720@60`, `1080-60` | auto | `-r 720,1080,1440@60` |
| `-c, --codec` | Video codec | `h264`, `av1` | auto (h264 + AV1 if HW) | `-c h264` |
| `-f, --format` | Streaming format | `dash`, `hls` | auto (dash + hls) | `-f dash` |
| `-p, --poster` | Poster timecode | `HH:MM:SS` or seconds | `00:00:00` | `-p 00:00:05` or `-p 10` |
| `-e, --encoder` | Video encoder | `auto`, `nvenc`, `qsv`, `amf`, `vaapi`, `videotoolbox`, `v4l2`, `cpu` | `auto` | `-e nvenc` |
| `-d, --decoder` | Video decoder (hwaccel) | `auto`, `nvenc`, `qsv`, `vaapi`, `videotoolbox`, `v4l2`, `cpu` | `auto` | `-d cpu` |
### Examples
```bash
# Default (DASH + HLS, dual codec, auto profiles)
# Default (DASH + HLS, auto codec, auto profiles)
create-vod video.mp4
# Custom output directory
@@ -83,8 +84,14 @@ create-vod video.mp4 -f hls -c h264
# Poster from 5th second
create-vod video.mp4 -p 5
# Force CPU encode/decode
create-vod video.mp4 -c h264 -e cpu -d cpu
# Force GPU encode + CPU decode
create-vod video.mp4 -c h264 -e nvenc -d cpu
# Combined parameters
create-vod video.mp4 ./output -r 720,1080@60,1440@60 -c dual -f both -p 00:00:10
create-vod video.mp4 ./output -r 720,1080@60,1440@60 -p 00:00:10
```
### Supported resolutions
@@ -103,11 +110,12 @@ High FPS (60/90/120) are generated only if the source supports that FPS.
## Defaults & Automation
- Segment duration: 2 seconds
- Hardware accel: auto-detect (GPU if available, else CPU)
- Hardware accel: auto-detect best encoder/decoder (GPU if available, else CPU)
- Profiles: auto-selected based on source resolution
- Bitrate: BPP-based dynamic calculation
- Thumbnails: auto sprite (160×90, 1s interval) + VTT
- Poster: first frame (0:00:00, configurable via `-p`)
- Parallel encoding: enabled
- AV1: enabled only if hardware AV1 encoder detected (in auto mode); otherwise остаётся H.264
**Requirements:** Node.js ≥18.0.0, FFmpeg, MP4Box (gpac), optional NVIDIA/Intel/AMD GPU for acceleration