Skip to content

Commit

Permalink
fix: types for the mp4box package
Browse files Browse the repository at this point in the history
  • Loading branch information
sujal-into committed Nov 22, 2024
1 parent 738d456 commit fc32d31
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions packages/utils/types/mp4box.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
declare module "mp4box" {
export interface MP4FileInfo {
duration: number; // Duration in timescale units
timescale: number; // Timescale of the file
isFragmented: boolean; // Whether the MP4 is fragmented
brands: string[]; // Major and compatible brands
created: Date; // Creation time
modified: Date; // Modification time
tracks: MP4Track[]; // Array of tracks in the file
}

export interface MP4Track {
id: number; // Track ID
type: string; // Track type (e.g., "video", "audio")
codec: string; // Codec used for this track
language: string; // Language of the track
created: Date; // Creation time
modified: Date; // Modification time
timescale: number; // Timescale for the track
duration: number; // Duration in timescale units
bitrate: number; // Average bitrate of the track
width?: number; // Video width (if applicable)
height?: number; // Video height (if applicable)
sampleCount: number; // Number of samples in the track
samples: any[]; // Detailed sample information
}

export interface MP4ArrayBuffer extends ArrayBuffer {
fileStart: number; // Start position of the buffer in the file
}

export interface MP4BoxFile {
onReady?: (info: MP4FileInfo) => void;
onError?: (error: string) => void;
appendBuffer(data: ArrayBuffer): number;
start(): void;
stop(): void;
flush(): void;
createFile(): MP4BoxFile;
}

export function createFile(): MP4BoxFile;
}

0 comments on commit fc32d31

Please sign in to comment.