feat(media): live fragmented MP4 (H.264/HEVC/AV1 + AAC/Opus), shade live video

Fmp4Splitter cuts ftyp+moov into the sticky init and moof+mdat into frames,
reading sync samples from trun/tfhd/trex flags so fragments shorter than a
GOP still mark where late joiners may start. Codec strings come from the
sample entries. MediaSplitter sniffs WebM vs fMP4; the CLI's new
`live video` uses it (`live webm` stays as the pinned form).

Verified: 9 new tests on real ffmpeg output; H.264/AAC live in headless
Chromium (49/49 fragments appended, late join, 3.2 s latency) and a sealed
H.264 film seeking to 24 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-18 21:27:50 +02:00
parent c5b897b924
commit 75dbf530ce
12 changed files with 710 additions and 26 deletions

View File

@@ -28,3 +28,9 @@ export { encodeContent, decodeContent, decodeFrame, FLAG_STICKY, FLAG_KEYFRAME,
export type { LiveContent, FrameHeader } from './live/frame.js';
export { LivePublishClient, LiveWatchClient, liveUrl } from './live/client.js';
export type { LiveState, PublishOptions, WatchOptions } from './live/client.js';
export { MediaSplitter, sniffContainer } from './splitter.js';
export type { MediaPiece, LiveContainer } from './splitter.js';
export { WebmSplitter, webmMime } from './webm.js';
export type { WebmPiece } from './webm.js';
export { Fmp4Splitter, fmp4Mime } from './fmp4.js';
export type { Fmp4Piece } from './fmp4.js';