Skip to content

Archive Playback & On-Demand Transmuxing ​

RUSEON Core provides a high-performance Archive Playback Subsystem (internal/archive/) that allows operators to stream and scrub through historical recordings with sub-second start latency without re-encoding video.


1. On-Demand HLS Archive Transmuxing ​

When a user selects a recording on the web dashboard timeline:

  1. The client queries available archive files:
    bash
    GET /api/cameras/cam-01/archive
  2. The player requests the dynamic archive HLS playlist:
    bash
    GET /hls/cam-01/archive.m3u8?file=2026-08-23_14-00-00_to_15-00-00.mp4
  3. The server generates an on-the-fly HLS playlist referencing virtual segments (/hls/cam-01/segment.ts?file=...&seq=0).
  4. When the player requests each segment, RUSEON reads the corresponding fMP4 fragment from disk and transmuxes it directly into MPEG-TS in memory.

2. In-Memory Box Indexing (IndexLRUCache) ​

Parsing multi-gigabyte video files repeatedly can cause disk read bottlenecks. RUSEON Core maintains an in-memory IndexLRUCache (capacity: 2,000 files) in internal/archive/hls.go:

  • Parses fMP4 moof + mdat box offsets once upon first access.
  • Caches the seek index in memory.
  • Enables instantaneous seeking across hours of video.

3. Video Clip Export API ​

Users can extract and download historical video clips as standalone standard MP4 files:

bash
curl -H "Authorization: Bearer <TOKEN>" \
  "http://localhost:8080/api/cameras/cam-01/export?file=2026-08-23_14-00-00_to_15-00-00.mp4&start_seq=0&end_seq=10" \
  -o incident_export.mp4

Released under the MIT License.