@invintusmedia/tomp4 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.d.ts DELETED
@@ -1,135 +0,0 @@
1
- declare module '@invintusmedia/tomp4' {
2
- export interface Mp4Result {
3
- /** Raw MP4 data */
4
- data: Uint8Array;
5
- /** Suggested filename */
6
- filename: string;
7
- /** Size in bytes */
8
- size: number;
9
- /** Human-readable size (e.g. "2.5 MB") */
10
- sizeFormatted: string;
11
- /** Get as Blob */
12
- toBlob(): Blob;
13
- /** Get as object URL for video.src */
14
- toURL(): string;
15
- /** Revoke the object URL to free memory */
16
- revokeURL(): void;
17
- /** Trigger browser download */
18
- download(filename?: string): void;
19
- /** Get as ArrayBuffer */
20
- toArrayBuffer(): ArrayBuffer;
21
- }
22
-
23
- export interface HlsVariant {
24
- url: string;
25
- bandwidth: number;
26
- resolution?: string;
27
- width?: number;
28
- height?: number;
29
- codecs?: string;
30
- }
31
-
32
- export interface HlsStream {
33
- masterUrl: string;
34
- variants: HlsVariant[];
35
- qualities: string[];
36
- select(quality: string | number): HlsStream;
37
- segments: string[];
38
- }
39
-
40
- export interface ToMp4Options {
41
- /** Progress callback */
42
- onProgress?: (message: string) => void;
43
- /** Suggested filename for downloads */
44
- filename?: string;
45
- /** HLS quality: 'highest', 'lowest', or bandwidth number */
46
- quality?: 'highest' | 'lowest' | number;
47
- /** Max HLS segments to download */
48
- maxSegments?: number;
49
- /** Start time in seconds (snaps to nearest keyframe) */
50
- startTime?: number;
51
- /** End time in seconds */
52
- endTime?: number;
53
- }
54
-
55
- export interface KeyframeInfo {
56
- /** Frame index */
57
- index: number;
58
- /** Time in seconds */
59
- time: number;
60
- }
61
-
62
- export interface AnalysisResult {
63
- /** Total duration in seconds */
64
- duration: number;
65
- /** Number of video frames */
66
- videoFrames: number;
67
- /** Number of audio frames */
68
- audioFrames: number;
69
- /** Keyframe positions */
70
- keyframes: KeyframeInfo[];
71
- /** Number of keyframes */
72
- keyframeCount: number;
73
- /** Video codec name */
74
- videoCodec: string;
75
- /** Audio codec name */
76
- audioCodec: string;
77
- /** Audio sample rate */
78
- audioSampleRate: number | null;
79
- /** Audio channel count */
80
- audioChannels: number | null;
81
- }
82
-
83
- /**
84
- * Convert video to MP4
85
- * @param input - URL, HLS stream, or video data
86
- * @param options - Conversion options
87
- */
88
- function toMp4(
89
- input: string | Uint8Array | ArrayBuffer | Blob | HlsStream,
90
- options?: ToMp4Options
91
- ): Promise<Mp4Result>;
92
-
93
- namespace toMp4 {
94
- /** Library version */
95
- const version: string;
96
-
97
- /** Convert MPEG-TS data to MP4 */
98
- function fromTs(data: Uint8Array | ArrayBuffer, options?: ToMp4Options): Mp4Result;
99
-
100
- /** Convert fMP4 data to MP4 */
101
- function fromFmp4(data: Uint8Array | ArrayBuffer): Mp4Result;
102
-
103
- /** Detect format of video data */
104
- function detectFormat(data: Uint8Array): 'mpegts' | 'fmp4' | 'mp4' | 'unknown';
105
-
106
- /** Check if data is MPEG-TS */
107
- function isMpegTs(data: Uint8Array): boolean;
108
-
109
- /** Check if data is fMP4 */
110
- function isFmp4(data: Uint8Array): boolean;
111
-
112
- /** Check if data is standard MP4 */
113
- function isStandardMp4(data: Uint8Array): boolean;
114
-
115
- /** Parse HLS playlist */
116
- function parseHls(url: string): Promise<HlsStream>;
117
-
118
- /** Download and combine HLS segments */
119
- function downloadHls(
120
- input: string | HlsStream,
121
- options?: ToMp4Options
122
- ): Promise<Uint8Array>;
123
-
124
- /** Check if URL is an HLS playlist */
125
- function isHlsUrl(url: string): boolean;
126
-
127
- /** Analyze MPEG-TS data without converting */
128
- function analyze(data: Uint8Array): AnalysisResult;
129
- }
130
-
131
- export default toMp4;
132
- export { toMp4 };
133
- }
134
-
135
-