Start work on HlsOutputFormat

This commit is contained in:
Vanilagy
2026-03-17 15:25:06 +01:00
parent e42fc85f19
commit dd8621b6d5
17 changed files with 619 additions and 72 deletions
+44
View File
@@ -28,6 +28,7 @@ import { OggMuxer } from './ogg/ogg-muxer';
import { Output, TrackType } from './output';
import { MpegTsMuxer } from './mpeg-ts/mpeg-ts-muxer';
import { WaveMuxer } from './wave/wave-muxer';
import { HlsMuxer } from './hls/hls-muxer';
/**
* Specifies an inclusive range of integers.
@@ -1081,3 +1082,46 @@ export class MpegTsOutputFormat extends OutputFormat {
return true;
}
}
export class HlsOutputFormat extends OutputFormat {
_createMuxer(output: Output): Muxer {
return new HlsMuxer(output);
}
get _name() {
return 'HTTP Live Streaming (HLS)';
}
get fileExtension() {
return '.m3u8';
}
get mimeType() {
return 'application/vnd.apple.mpegurl';
}
getSupportedCodecs(): MediaCodec[] {
// TODO this should vary based on the HLS "variant"
return [
...VIDEO_CODECS.filter(codec => ['avc', 'hevc'].includes(codec)),
...AUDIO_CODECS.filter(codec => ['aac', 'mp3', 'ac3', 'eac3'].includes(codec)),
];
}
getSupportedTrackCounts(): TrackCountLimits {
return {
video: { min: 0, max: Infinity },
audio: { min: 0, max: Infinity },
subtitle: { min: 0, max: Infinity },
total: { min: 1, max: Infinity },
};
}
get supportsVideoRotationMetadata(): boolean {
return false; // TODO this is not true with fmp4
}
get supportsTimestampedMediaData(): boolean {
return true; // I guess??
}
}