Add ConversionOptions.tracks, add better converstion start timestamp computation, optimize endPacket logic, utilize metadata duration for progress callback for better performance

This commit is contained in:
Vanilagy
2026-04-08 17:07:02 +02:00
parent fdb5f4102f
commit 7d053ae50d
6 changed files with 131 additions and 38 deletions
+4 -1
View File
@@ -342,7 +342,7 @@ export class Input<S extends Source = Source> extends EventEmitter<InputEvents>
return this._format;
}
async isSupported(): Promise<boolean> {
async canRead(): Promise<boolean> {
try {
await this._getDemuxer();
return true;
@@ -376,6 +376,9 @@ export class Input<S extends Source = Source> extends EventEmitter<InputEvents>
/**
* Returns the timestamp at which the input file starts. More precisely, returns the smallest starting timestamp
* among all tracks.
*
* Note that this method is potentially expensive for inputs with many tracks (such as HLS manifests), since it
* probes every track.
*/
async getFirstTimestamp() {
const tracks = await this.getTracks();