@lumen5/framefusion 0.0.3
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/LICENSE +674 -0
- package/README.md +79 -0
- package/dist/framefusion.cjs +2 -0
- package/dist/framefusion.cjs.map +1 -0
- package/dist/framefusion.d.ts +27 -0
- package/dist/framefusion.es.js +512 -0
- package/dist/framefusion.es.js.map +1 -0
- package/dist/framefusion.js +32 -0
- package/dist/framefusion.js.map +1 -0
- package/dist/src/BaseExtractor.d.ts +24 -0
- package/dist/src/BaseExtractor.js +45 -0
- package/dist/src/BaseExtractor.js.map +1 -0
- package/dist/src/DownloadVideoURL.d.ts +17 -0
- package/dist/src/DownloadVideoURL.js +77 -0
- package/dist/src/DownloadVideoURL.js.map +1 -0
- package/dist/src/backends/beamcoder.d.ts +184 -0
- package/dist/src/backends/beamcoder.js +626 -0
- package/dist/src/backends/beamcoder.js.map +1 -0
- package/dist/test/downloadurl.test.d.ts +1 -0
- package/dist/test/downloadurl.test.js +20 -0
- package/dist/test/downloadurl.test.js.map +1 -0
- package/dist/test/framefusion.test.d.ts +8 -0
- package/dist/test/framefusion.test.js +362 -0
- package/dist/test/framefusion.test.js.map +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.config.js +35 -0
- package/dist/vite.config.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +9 -0
- package/dist/vitest.config.js.map +1 -0
- package/dist/vitest.global.d.ts +1 -0
- package/dist/vitest.global.js +5 -0
- package/dist/vitest.global.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export class BaseExtractor {
|
|
2
|
+
static async create(args) {
|
|
3
|
+
throw new Error('Not implemented');
|
|
4
|
+
}
|
|
5
|
+
async init({ inputFileOrUrl, outputFile, threadCount = 8, endTime, interpolateFps, interpolateMode, }) {
|
|
6
|
+
throw new Error('Not implemented');
|
|
7
|
+
}
|
|
8
|
+
get duration() {
|
|
9
|
+
throw new Error('Not implemented');
|
|
10
|
+
}
|
|
11
|
+
get width() {
|
|
12
|
+
throw new Error('Not implemented');
|
|
13
|
+
}
|
|
14
|
+
get height() {
|
|
15
|
+
throw new Error('Not implemented');
|
|
16
|
+
}
|
|
17
|
+
async seekToPTS(targetPts) {
|
|
18
|
+
throw new Error('Not implemented');
|
|
19
|
+
}
|
|
20
|
+
async getFrameAtTime(targetTime) {
|
|
21
|
+
throw new Error('Not implemented');
|
|
22
|
+
}
|
|
23
|
+
async getFrameAtPts(targetPts) {
|
|
24
|
+
throw new Error('Not implemented');
|
|
25
|
+
}
|
|
26
|
+
async seekToTime(targetTime) {
|
|
27
|
+
throw new Error('Not implemented');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Convert a PTS (based on timebase) to PTS (in seconds)
|
|
31
|
+
*/
|
|
32
|
+
ptsToTime(pts) {
|
|
33
|
+
throw new Error('Not implemented');
|
|
34
|
+
}
|
|
35
|
+
async readFrames({ onFrameAvailable, flush = true, } = {
|
|
36
|
+
flush: true,
|
|
37
|
+
onFrameAvailable: () => true,
|
|
38
|
+
}) {
|
|
39
|
+
throw new Error('Not implemented');
|
|
40
|
+
}
|
|
41
|
+
async dispose() {
|
|
42
|
+
throw new Error('Not implemented');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=BaseExtractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseExtractor.js","sourceRoot":"","sources":["../../src/BaseExtractor.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,aAAa;IACtB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAmB;QACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EACP,cAAc,EACd,UAAU,EACV,WAAW,GAAG,CAAC,EACf,OAAO,EACP,cAAc,EACd,eAAe,GACH;QACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,QAAQ;QACR,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,KAAK;QACL,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM;QACN,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC7B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,UAAkB;QACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACjC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,UAAkB;QAC/B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,GAAW;QACjB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EACb,gBAAgB,EAChB,KAAK,GAAG,IAAI,MAOZ;QACA,KAAK,EAAE,IAAI;QACX,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI;KAC/B;QACG,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downloads a video file from a given URL as a temporary file. When the object is cleared, the temporary file is
|
|
3
|
+
* deleted.
|
|
4
|
+
*/
|
|
5
|
+
export declare class DownloadVideoURL {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(url: any);
|
|
8
|
+
/**
|
|
9
|
+
* returns the filepath of the downloaded file. If the file has not been downloaded yet, it will be undefined
|
|
10
|
+
*/
|
|
11
|
+
get filepath(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Downloads the file from the given URL. The file will be downloaded to a temporary file.
|
|
14
|
+
*/
|
|
15
|
+
download(): Promise<void>;
|
|
16
|
+
clear(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import https from 'node:https';
|
|
3
|
+
import http from 'http';
|
|
4
|
+
import tmp from 'tmp';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
class CancelRequestError extends Error {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Downloads a video file from a given URL as a temporary file. When the object is cleared, the temporary file is
|
|
10
|
+
* deleted.
|
|
11
|
+
*/
|
|
12
|
+
export class DownloadVideoURL {
|
|
13
|
+
#url;
|
|
14
|
+
#httpRequest = undefined;
|
|
15
|
+
#filepath = undefined;
|
|
16
|
+
#tmpObj = undefined;
|
|
17
|
+
constructor(url) {
|
|
18
|
+
this.#url = url;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* returns the filepath of the downloaded file. If the file has not been downloaded yet, it will be undefined
|
|
22
|
+
*/
|
|
23
|
+
get filepath() {
|
|
24
|
+
return this.#filepath;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Downloads the file from the given URL. The file will be downloaded to a temporary file.
|
|
28
|
+
*/
|
|
29
|
+
async download() {
|
|
30
|
+
await new Promise((resolve, reject) => {
|
|
31
|
+
const source = this.#url;
|
|
32
|
+
const extension = path.extname(source);
|
|
33
|
+
this.#tmpObj = tmp.fileSync({ postfix: extension });
|
|
34
|
+
try {
|
|
35
|
+
const connectionHandler = source.startsWith('https://') ? https : http;
|
|
36
|
+
this.#httpRequest = connectionHandler.get(source, (res) => {
|
|
37
|
+
const contentType = res.headers['content-type'];
|
|
38
|
+
if (!contentType.includes('video')) {
|
|
39
|
+
const err = new Error(`Source ${source}, returned unsupported content type ${contentType}`);
|
|
40
|
+
reject(err);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const writeStream = fs.createWriteStream(this.#tmpObj.name);
|
|
44
|
+
res.pipe(writeStream);
|
|
45
|
+
writeStream.on('finish', () => {
|
|
46
|
+
writeStream.close();
|
|
47
|
+
this.#filepath = this.#tmpObj.name;
|
|
48
|
+
resolve();
|
|
49
|
+
});
|
|
50
|
+
writeStream.on('error', (e) => {
|
|
51
|
+
reject(e);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
this.#httpRequest.on('error', (e) => {
|
|
55
|
+
if (e instanceof CancelRequestError) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
reject(e);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
reject(e);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
clear() {
|
|
67
|
+
if (this.#tmpObj)
|
|
68
|
+
this.#tmpObj.removeCallback();
|
|
69
|
+
if (this.#url)
|
|
70
|
+
this.#url = undefined;
|
|
71
|
+
if (this.#httpRequest)
|
|
72
|
+
this.#httpRequest = null;
|
|
73
|
+
if (this.#filepath)
|
|
74
|
+
this.#filepath = undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=DownloadVideoURL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadVideoURL.js","sourceRoot":"","sources":["../../src/DownloadVideoURL.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ReadStream } from 'fs';
|
|
3
|
+
import type { Frame } from 'beamcoder';
|
|
4
|
+
import beamcoder from 'beamcoder';
|
|
5
|
+
import type { Extractor, ExtractorArgs } from '../../framefusion.js';
|
|
6
|
+
import { BaseExtractor } from '../BaseExtractor.js';
|
|
7
|
+
/**
|
|
8
|
+
* Assumptions made by this library:
|
|
9
|
+
*
|
|
10
|
+
* - The input is always a mp4
|
|
11
|
+
* It would be nice to support other formats. One thing to change is the iformat, hardcoded for mp4.
|
|
12
|
+
*
|
|
13
|
+
* - Stream 0 is the video stream we want to extract.
|
|
14
|
+
* It would be good to detect cases where stream 0 is an audio stream an switch to the next stream.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare const probeCodecPar: (codecpar: any) => {
|
|
18
|
+
type: any;
|
|
19
|
+
codec_type: any;
|
|
20
|
+
codec_id: any;
|
|
21
|
+
name: any;
|
|
22
|
+
codec_tag: any;
|
|
23
|
+
extradata: any;
|
|
24
|
+
format: any;
|
|
25
|
+
bit_rate: any;
|
|
26
|
+
bits_per_coded_sample: any;
|
|
27
|
+
bits_per_raw_sample: any;
|
|
28
|
+
profile: any;
|
|
29
|
+
level: any;
|
|
30
|
+
width: any;
|
|
31
|
+
height: any;
|
|
32
|
+
sample_aspect_ratio: any;
|
|
33
|
+
field_order: any;
|
|
34
|
+
color_range: any;
|
|
35
|
+
color_primaries: any;
|
|
36
|
+
color_trc: any;
|
|
37
|
+
color_space: any;
|
|
38
|
+
chroma_location: any;
|
|
39
|
+
video_delay: any;
|
|
40
|
+
channel_layout: any;
|
|
41
|
+
channels: any;
|
|
42
|
+
sample_rate: any;
|
|
43
|
+
block_align: any;
|
|
44
|
+
frame_size: any;
|
|
45
|
+
initial_padding: any;
|
|
46
|
+
trailing_padding: any;
|
|
47
|
+
seek_preroll: any;
|
|
48
|
+
};
|
|
49
|
+
export declare const probeStream: (stream: any) => {
|
|
50
|
+
type: any;
|
|
51
|
+
index: any;
|
|
52
|
+
id: any;
|
|
53
|
+
time_base: any;
|
|
54
|
+
start_time: any;
|
|
55
|
+
duration: any;
|
|
56
|
+
nb_frames: any;
|
|
57
|
+
disposition: any;
|
|
58
|
+
discard: any;
|
|
59
|
+
sample_aspect_ratio: any;
|
|
60
|
+
metadata: any;
|
|
61
|
+
avg_frame_rate: any;
|
|
62
|
+
attached_pic: any;
|
|
63
|
+
side_data: any;
|
|
64
|
+
event_flags: any;
|
|
65
|
+
r_frame_rate: any;
|
|
66
|
+
codecpar: {
|
|
67
|
+
type: any;
|
|
68
|
+
codec_type: any;
|
|
69
|
+
codec_id: any;
|
|
70
|
+
name: any;
|
|
71
|
+
codec_tag: any;
|
|
72
|
+
extradata: any;
|
|
73
|
+
format: any;
|
|
74
|
+
bit_rate: any;
|
|
75
|
+
bits_per_coded_sample: any;
|
|
76
|
+
bits_per_raw_sample: any;
|
|
77
|
+
profile: any;
|
|
78
|
+
level: any;
|
|
79
|
+
width: any;
|
|
80
|
+
height: any;
|
|
81
|
+
sample_aspect_ratio: any;
|
|
82
|
+
field_order: any;
|
|
83
|
+
color_range: any;
|
|
84
|
+
color_primaries: any;
|
|
85
|
+
color_trc: any;
|
|
86
|
+
color_space: any;
|
|
87
|
+
chroma_location: any;
|
|
88
|
+
video_delay: any;
|
|
89
|
+
channel_layout: any;
|
|
90
|
+
channels: any;
|
|
91
|
+
sample_rate: any;
|
|
92
|
+
block_align: any;
|
|
93
|
+
frame_size: any;
|
|
94
|
+
initial_padding: any;
|
|
95
|
+
trailing_padding: any;
|
|
96
|
+
seek_preroll: any;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Class to keep track of the muxer/demuxer/encoder/muxer used while extracting a video to frames.
|
|
101
|
+
*/
|
|
102
|
+
export declare class BeamcoderExtractor extends BaseExtractor implements Extractor {
|
|
103
|
+
#private;
|
|
104
|
+
decoder: beamcoder.Decoder;
|
|
105
|
+
demuxer: beamcoder.Demuxer;
|
|
106
|
+
encoder: beamcoder.Encoder;
|
|
107
|
+
muxer: beamcoder.Muxer;
|
|
108
|
+
filterer: beamcoder.Filterer;
|
|
109
|
+
packet: beamcoder.Packet;
|
|
110
|
+
endTime: number;
|
|
111
|
+
demuxerStream: beamcoder.WritableDemuxerStream;
|
|
112
|
+
readStream: ReadStream;
|
|
113
|
+
lastFrame: beamcoder.Frame;
|
|
114
|
+
filteredFrames: beamcoder.Frame[];
|
|
115
|
+
/**
|
|
116
|
+
* Encoder/Decoder constuction is async, so it can't be put in a regular constructor.
|
|
117
|
+
*
|
|
118
|
+
* Use and await this method to generate an extactor.
|
|
119
|
+
*/
|
|
120
|
+
static create(args: ExtractorArgs): Promise<Extractor>;
|
|
121
|
+
init({ inputFileOrUrl, outputFile, threadCount, endTime, interpolateFps, interpolateMode, outputPixelFormat, }: ExtractorArgs): Promise<void>;
|
|
122
|
+
get duration(): number;
|
|
123
|
+
get width(): number;
|
|
124
|
+
get height(): number;
|
|
125
|
+
/**
|
|
126
|
+
* Seek to a given PTS in the stream
|
|
127
|
+
*
|
|
128
|
+
* PTS stands for presentation time stamp. It's expressed in time_base units.
|
|
129
|
+
* If timebase is 1/10000,
|
|
130
|
+
* and a frame PTS is 10000,
|
|
131
|
+
* Then the frame must be displayed at exactly 1 second.
|
|
132
|
+
*/
|
|
133
|
+
seekToPTS(targetPts: number): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Dump one frame at a specific time
|
|
136
|
+
*
|
|
137
|
+
* This method can seek as required, but generally, it is designed to be
|
|
138
|
+
* performant in the cases where we progressively read a video frame by frame.
|
|
139
|
+
*
|
|
140
|
+
* So the implementation in here should not seek all the time, but rather
|
|
141
|
+
* read packets as they come, when possible,
|
|
142
|
+
*
|
|
143
|
+
* @see getFrameAtPts()
|
|
144
|
+
*/
|
|
145
|
+
getFrameAtTime(targetTime: number): Promise<beamcoder.Frame>;
|
|
146
|
+
/**
|
|
147
|
+
* Dump one frame at a specific pts
|
|
148
|
+
*
|
|
149
|
+
* This method can seek as required, but generally, it is designed to be
|
|
150
|
+
* performant in the cases where we progressively read a video frame by frame.
|
|
151
|
+
*
|
|
152
|
+
* So the implementation in here should not seek all the time, but rather
|
|
153
|
+
* read packets as they come, when possible,
|
|
154
|
+
*/
|
|
155
|
+
getFrameAtPts(targetPts: number): Promise<beamcoder.Frame>;
|
|
156
|
+
/**
|
|
157
|
+
* Seek to a given time in the stream
|
|
158
|
+
*/
|
|
159
|
+
seekToTime(targetTime: number): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Convert a time (in seconds) to PTS (based on timebase)
|
|
162
|
+
*/
|
|
163
|
+
timeToPts(time: number): number;
|
|
164
|
+
/**
|
|
165
|
+
* Convert a PTS (based on timebase) to PTS (in seconds)
|
|
166
|
+
*/
|
|
167
|
+
ptsToTime(pts: number): number;
|
|
168
|
+
/**
|
|
169
|
+
* Detect multiple access to beamcoder which could put our system in an unexpected state.
|
|
170
|
+
*/
|
|
171
|
+
withLock(callback: any): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Dump all frames from the current point.
|
|
174
|
+
* Stops processing packets after target is reached.
|
|
175
|
+
*/
|
|
176
|
+
readFrames({ onFrameAvailable, flush, }?: {
|
|
177
|
+
/**
|
|
178
|
+
* Return true if we need to read more frames.
|
|
179
|
+
*/
|
|
180
|
+
onFrameAvailable?: (frame: Frame) => Promise<boolean> | boolean;
|
|
181
|
+
flush?: boolean;
|
|
182
|
+
}): Promise<void>;
|
|
183
|
+
dispose(): Promise<void>;
|
|
184
|
+
}
|