feat(stream): burn bitmap (PGS/DVB) subtitles into the video via overlay

Bitmap subs can't be served as WebVTT, so the user picks one and the daemon
re-encodes with it overlaid. HLSSessionConfig.BurnSubtitleIndex (*int, nil=no
burn) flows into the cache key + a -filter_complex graph:
  [0✌️0]<vchain>[base];[0:s:N][base]scale2ref[sub][base2];[base2][sub]overlay[vout]
Overlay after the tonemap (SDR subs keep brightness); scale2ref fits the PGS
canvas to the output. Invalid/text/out-of-range index -> clean-encode fallback.
IsTextSubtitle now includes "text" (parity with the web classifier).
This commit is contained in:
Deivid Soto 2026-06-01 09:51:27 +02:00
parent 8207d1d2a9
commit 665ec0a34f
9 changed files with 196 additions and 49 deletions

View file

@ -669,14 +669,15 @@ func runDaemonStart() error {
}
hlsCtx, hlsCancel := context.WithCancel(ctx)
startHLSPlayback(engine.HLSSessionConfig{
SessionID: sess.SessionID,
SourceURL: sess.DirectURL,
CacheID: sess.InfoHash,
FileName: sess.FileName,
Quality: sess.Quality,
AudioIndex: sess.AudioIndex,
Transcode: tcRuntime,
Cache: hlsCache,
SessionID: sess.SessionID,
SourceURL: sess.DirectURL,
CacheID: sess.InfoHash,
FileName: sess.FileName,
Quality: sess.Quality,
AudioIndex: sess.AudioIndex,
BurnSubtitleIndex: sess.BurnSubtitleIndex,
Transcode: tcRuntime,
Cache: hlsCache,
// 2c: refresh the debrid link if it expires mid-transcode; the
// auto-restart supervisor calls this before relaunching ffmpeg.
RefreshURL: func(rctx context.Context) (string, error) {
@ -788,13 +789,14 @@ func runDaemonStart() error {
// that absorbs the gap until the playlist registers.
hlsCtx, hlsCancel := context.WithCancel(ctx)
startHLSPlayback(engine.HLSSessionConfig{
SessionID: sess.SessionID,
SourcePath: filePath,
FileName: sess.FileName,
Quality: sess.Quality,
AudioIndex: sess.AudioIndex,
Transcode: tcRuntime,
Cache: hlsCache,
SessionID: sess.SessionID,
SourcePath: filePath,
FileName: sess.FileName,
Quality: sess.Quality,
AudioIndex: sess.AudioIndex,
BurnSubtitleIndex: sess.BurnSubtitleIndex,
Transcode: tcRuntime,
Cache: hlsCache,
}, hlsCtx, hlsCancel)
}