feat(hls): faster first-start — probe cache + tighter encoder presets (0.9.9)
Reduces first-segment latency on cache MISS so the player doesn't sit on
"preparando sesión". Three independent levers:
1. ProbeFile memoised by (path, mtime, size) for 30 min — second play of
the same source skips ffprobe (1-3 s on 50+ GB MKVs).
2. HLS encoder presets biased for latency over quality:
- libx264 default veryfast → superfast (~15-20% faster, marginal
quality loss at 5-25 Mbps target bitrates).
- NVENC: -preset p4 -tune hq → -preset p3 -tune ll. First-segment
~0.8 s on RTX-class GPUs (was ~1.5 s).
- QSV: -preset medium → -preset veryfast (keeps look_ahead=0).
- VideoToolbox: adds -realtime 1 (was unset). Bitrate args still
drive rate control; -q:v dropped to avoid the silent conflict
where ffmpeg ignored it under -b:v.
3. Per-session log surfaces encoder + accel + preset so "first-start
was slow" complaints can be triaged from the journal alone.
Diagnostic helpers (DetectHWAccelDiagnostic + HWAccelDiagnostic) added
for future wiring into daemon startup / agent register; users today can
already inspect via `unarr probe-hwaccel`.
Web: AgentsTab profile page now shows the agent's chosen encoder
(amber if software libx264, green if HW) plus the transcode-resolution
cap. Hidden for pre-0.9.9 agents that haven't reported hwAccel.
This commit is contained in:
parent
7b78d0b778
commit
3b8d77b496
8 changed files with 593 additions and 17 deletions
|
|
@ -88,7 +88,15 @@ const (
|
|||
)
|
||||
|
||||
// ProbeFile runs ffprobe and returns a StreamProbe view of the file.
|
||||
//
|
||||
// Result is memoised by (path, mtime, size) for probeCacheTTL — repeat plays
|
||||
// of the same file at the same quality (the HLS cache HIT path) skip ffprobe
|
||||
// entirely. ffprobe on a 50 GB MKV can cost 1-3 s; first-segment latency
|
||||
// shrinks by the same amount on the second play.
|
||||
func ProbeFile(ctx context.Context, ffprobePath, filePath string) (*StreamProbe, error) {
|
||||
if cached, ok := lookupProbeCache(filePath); ok {
|
||||
return cached, nil
|
||||
}
|
||||
mi, err := mediainfo.ExtractMediaInfo(ctx, ffprobePath, filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("probe: %w", err)
|
||||
|
|
@ -136,6 +144,7 @@ func ProbeFile(ctx context.Context, ffprobePath, filePath string) (*StreamProbe,
|
|||
})
|
||||
}
|
||||
}
|
||||
storeProbeCache(filePath, probe)
|
||||
return probe, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue