Input
Represents an input media file. This is the root object from which all media read operations start.
Used by
Type parameters
Input<
S extends Source = Source,
>
See Source
.
Constructor
constructor(
options: InputOptions<S>,
): Input;
Creates a new input file from the specified options. No reading operations will be performed until methods are called on this instance.
See InputOptions
.
Properties
source
get source(): S;
Returns the source from which this input file reads its data. This is the same source that was passed to the constructor.
Methods
getFormat()
getFormat(): Promise<InputFormat>;
Returns the format of the input file. You can compare this result directly to the InputFormat
singletons or use instanceof
checks for subset-aware logic (for example, format instanceof MatroskaInputFormat
is true for both MKV and WebM).
computeDuration()
computeDuration(): Promise<number>;
Computes the duration of the input file, in seconds. More precisely, returns the largest end timestamp among all tracks.
getTracks()
getTracks(): Promise<InputTrack[]>;
Returns the list of all tracks of this input file.
See InputTrack
.
getVideoTracks()
getVideoTracks(): Promise<InputVideoTrack[]>;
Returns the list of all video tracks of this input file.
See InputVideoTrack
.
getAudioTracks()
getAudioTracks(): Promise<InputAudioTrack[]>;
Returns the list of all audio tracks of this input file.
See InputAudioTrack
.
getPrimaryVideoTrack()
getPrimaryVideoTrack(): Promise<InputVideoTrack | null>;
Returns the primary video track of this input file, or null if there are no video tracks.
See InputVideoTrack
.
getPrimaryAudioTrack()
getPrimaryAudioTrack(): Promise<InputAudioTrack | null>;
Returns the primary audio track of this input file, or null if there are no audio tracks.
See InputAudioTrack
.
getMimeType()
getMimeType(): Promise<string>;
Returns the full MIME type of this input file, including track codecs.
getMetadataTags()
getMetadataTags(): Promise<MetadataTags>;
Returns descriptive metadata tags about the media file, such as title, author, date, or cover art.
See MetadataTags
.