Bläddra i källkod

perf: hls_time=2, hls_list_size=0 — reduce max seek latency

- hls_time=2: max frames to decode per seek/step drops from 180 → 60
  (worst case decode cost: ~660ms → ~220ms at 30fps)
- hls_list_size=0: no cap on playlist entries — preserves full seek
  map for the entire video regardless of length

Note: All-I-frame (keyint=1) will be evaluated in a follow-up if hls_time=2
does not sufficiently improve frame-step responsiveness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude Dev 1 månad sedan
förälder
incheckning
ac70e48855
1 ändrade filer med 6 tillägg och 6 borttagningar
  1. 6 6
      packages/api/src/worker/index.js

+ 6 - 6
packages/api/src/worker/index.js

@@ -86,18 +86,18 @@ function transcodeToHLS(videoPath, outputDir, assetId, duration) {
     let lastPct = 0;
 
     ffmpeg(videoPath)
-      // ── Re-encode to H.264 + AAC (universal browser support) ─────────────
+      // ── Re-encode to H.264 + AAC ────────────────────────────────────────
       .outputOptions([
-        '-c:v libx264',         // H.264 — every browser supports via MSE
-        '-c:a aac',             // AAC — universal audio codec
-        '-movflags +faststart', // moov atom at front → fast playback start
+        '-c:v libx264',
+        '-c:a aac',
+        '-movflags +faststart',
         '-preset fast',
         '-crf 23',
-        // HLS output
         '-f hls',
-        '-hls_time 6',
+        '-hls_time 2',
         '-hls_playlist_type vod',
         '-hls_segment_filename', segmentPattern,
+        '-hls_list_size 0',
       ])
       .output(playlistPath)
       .on('progress', ({ percent }) => {