libav-wasm 0.3.4 → 0.5.0

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/README.md CHANGED
@@ -63,10 +63,10 @@ To have C++ autocompletion, put a ffmpeg repo clone folder in the root
63
63
 
64
64
 
65
65
  ## Issues to fix / features to implement
66
+ - Try to play around with `sourceBuffer.timestampOffset = res.pts` and always increasing timestamps to not have to re-init on backwards seeks
66
67
  - Transcoding
67
68
  - Decoding + canvas rendering
68
69
  - Thumbnail extraction
69
70
 
70
-
71
71
  <!-- https://www.ffmpeg.org/doxygen/trunk/remuxing_8c-example.html -->
72
72
  <!-- https://github.com/leandromoreira/ffmpeg-libav-tutorial -->
package/build/index.d.ts CHANGED
@@ -1,52 +1,60 @@
1
- export type MakeTransmuxerOptions = {
2
- /** Path that will be used to locate the .wasm file imported from the worker */
3
- publicPath: string;
4
- /** Path that will be used to locate the javascript worker file */
5
- workerUrl: string;
6
- workerOptions?: WorkerOptions;
7
- getStream: (offset: number, size?: number) => Promise<ReadableStream<Uint8Array>>;
8
- subtitle: (title: string, language: string, data: string) => Promise<void> | void;
9
- attachment: (filename: string, mimetype: string, buffer: ArrayBuffer) => Promise<void> | void;
10
- length: number;
11
- bufferSize: number;
12
- };
13
- export type Dialogue = {
14
- index: number;
15
- data: string;
16
- startTime: number;
17
- endTime: number;
18
- layerIndex: number;
19
- dialogue: string;
20
- };
21
- export type Subtitle = {
22
- streamIndex: number;
23
- language: string;
24
- title: string;
25
- header: string;
26
- dialogues: Dialogue[];
27
- };
28
- export type MediaInfo = {
29
- formatName: string;
30
- mimeType: string;
31
- duration: number;
32
- video_mime_type: string;
33
- audio_mime_type: string;
34
- };
35
- export type Chunk = {
36
- isTrailer: boolean;
37
- offset: number;
38
- buffer: Uint8Array;
39
- pts: number;
40
- duration: number;
41
- pos: number;
42
- };
43
- export declare const makeRemuxer: ({ publicPath, workerUrl, workerOptions, getStream: _getStream, attachment, subtitle: _subtitle, length, bufferSize }: MakeTransmuxerOptions) => Promise<{
44
- init: () => Promise<Chunk>;
45
- destroy: (destroyWorker?: boolean) => void;
46
- read: () => Promise<Chunk>;
47
- seek: (time: number) => Promise<void>;
48
- getInfo: () => Promise<{
49
- input: MediaInfo;
50
- output: MediaInfo;
51
- }>;
52
- }>;
1
+ import type { SubtitleFragment } from './worker';
2
+ export * from './utils';
3
+ export type MakeTransmuxerOptions = {
4
+ /** Path that will be used to locate the .wasm file imported from the worker */
5
+ publicPath: string;
6
+ /** Path that will be used to locate the javascript worker file */
7
+ workerUrl: string;
8
+ workerOptions?: WorkerOptions;
9
+ getStream: (offset: number, size?: number) => Promise<ReadableStream<Uint8Array>>;
10
+ length: number;
11
+ bufferSize: number;
12
+ };
13
+ export declare const makeRemuxer: ({ publicPath, workerUrl, workerOptions, getStream, length, bufferSize }: MakeTransmuxerOptions) => Promise<{
14
+ worker: Worker;
15
+ init: () => Promise<{
16
+ data: ArrayBuffer;
17
+ attachments: import("./worker").Attachment[];
18
+ subtitles: SubtitleFragment[];
19
+ info: {
20
+ input: {
21
+ audioMimeType: string;
22
+ duration: number;
23
+ formatName: string;
24
+ mimeType: string;
25
+ videoMimeType: string;
26
+ };
27
+ output: {
28
+ audioMimeType: string;
29
+ duration: number;
30
+ formatName: string;
31
+ mimeType: string;
32
+ videoMimeType: string;
33
+ };
34
+ };
35
+ chapters: import("./worker").Chapter[];
36
+ indexes: import("./worker").Index[];
37
+ videoExtradata: ArrayBuffer;
38
+ }>;
39
+ destroy: () => Promise<void>;
40
+ seek: (timestamp: number) => Promise<{
41
+ data: ArrayBuffer;
42
+ subtitles: SubtitleFragment[];
43
+ offset: number;
44
+ pts: number;
45
+ duration: number;
46
+ cancelled: boolean;
47
+ finished: boolean;
48
+ }>;
49
+ read: () => Promise<{
50
+ data: ArrayBuffer;
51
+ subtitles: SubtitleFragment[];
52
+ offset: number;
53
+ pts: number;
54
+ duration: number;
55
+ cancelled: boolean;
56
+ finished: boolean;
57
+ thumbnailData: Uint8Array;
58
+ }>;
59
+ readKeyframe: (timestamp: number) => Promise<ArrayBuffer>;
60
+ }>;