Add support for writing Unix epoch-relative tracks to HLS, add proper cleanup of all Targets obtained by an Output

This commit is contained in:
Vanilagy
2026-03-31 15:12:38 +02:00
parent b06e407d65
commit 340b5eede7
19 changed files with 197 additions and 36 deletions
+1 -1
View File
@@ -2558,7 +2558,7 @@ abstract class IsobmffTrackBacking implements InputTrackBacking {
return this.internalTrack.timescale;
}
getTimestampsAreRelativeToUnixEpoch() {
isRelativeToUnixEpoch() {
return false;
}
+3 -5
View File
@@ -24,7 +24,7 @@ import {
import { Muxer } from '../muxer';
import { Output, OutputAudioTrack, OutputSubtitleTrack, OutputTrack, OutputVideoTrack } from '../output';
import { Writer } from '../writer';
import { BufferTarget, Target } from '../target';
import { BufferTarget } from '../target';
import { assert, computeRationalApproximation, last, promiseWithResolvers, Rational, simplifyRational } from '../misc';
import { IsobmffOutputFormatOptions, IsobmffOutputFormat, MovOutputFormat, CmafOutputFormat } from '../output-format';
import { inlineTimestampRegex, SubtitleConfig, SubtitleCue, SubtitleMetadata } from '../subtitles';
@@ -228,7 +228,7 @@ export class IsobmffMuxer extends Muxer {
}
if (this.isCmaf) {
if (this.output._initTarget === null) {
if (!this.output._hasInitTarget()) {
throw new Error(
`CMAF outputs require the initTarget field in OutputOptions to be set; the init segment`
+ ` will be written to it.`,
@@ -236,9 +236,7 @@ export class IsobmffMuxer extends Muxer {
}
// Set up the init writer to which we'll write the init segment
const initTarget = this.output._initTarget instanceof Target
? this.output._initTarget
: await this.output._initTarget();
const initTarget = await this.output._getInitTarget();
const initWriter = new Writer(initTarget);
initWriter.start();