@xyo-network/image-thumbnail-plugin 2.72.1 → 2.72.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/dist/cjs/Witness/Witness.js +98 -33
- package/dist/cjs/Witness/Witness.js.map +1 -1
- package/dist/cjs/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.js +53 -0
- package/dist/cjs/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.js.map +1 -0
- package/dist/cjs/Witness/ffmpeg/fluent/index.js +5 -0
- package/dist/cjs/Witness/ffmpeg/fluent/index.js.map +1 -0
- package/dist/cjs/Witness/ffmpeg/index.js +6 -0
- package/dist/cjs/Witness/ffmpeg/index.js.map +1 -0
- package/dist/cjs/Witness/ffmpeg/spawn/executeFfmpeg.js +33 -0
- package/dist/cjs/Witness/ffmpeg/spawn/executeFfmpeg.js.map +1 -0
- package/dist/cjs/Witness/ffmpeg/spawn/getVideoFrameAsImage.js +16 -0
- package/dist/cjs/Witness/ffmpeg/spawn/getVideoFrameAsImage.js.map +1 -0
- package/dist/cjs/Witness/ffmpeg/spawn/index.js +6 -0
- package/dist/cjs/Witness/ffmpeg/spawn/index.js.map +1 -0
- package/dist/docs.json +4577 -3694
- package/dist/esm/Witness/Witness.js +93 -32
- package/dist/esm/Witness/Witness.js.map +1 -1
- package/dist/esm/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.js +48 -0
- package/dist/esm/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.js.map +1 -0
- package/dist/esm/Witness/ffmpeg/fluent/index.js +2 -0
- package/dist/esm/Witness/ffmpeg/fluent/index.js.map +1 -0
- package/dist/esm/Witness/ffmpeg/index.js +3 -0
- package/dist/esm/Witness/ffmpeg/index.js.map +1 -0
- package/dist/esm/Witness/ffmpeg/spawn/executeFfmpeg.js +29 -0
- package/dist/esm/Witness/ffmpeg/spawn/executeFfmpeg.js.map +1 -0
- package/dist/esm/Witness/ffmpeg/spawn/getVideoFrameAsImage.js +11 -0
- package/dist/esm/Witness/ffmpeg/spawn/getVideoFrameAsImage.js.map +1 -0
- package/dist/esm/Witness/ffmpeg/spawn/index.js +3 -0
- package/dist/esm/Witness/ffmpeg/spawn/index.js.map +1 -0
- package/dist/types/Plugin.d.ts +1 -0
- package/dist/types/Plugin.d.ts.map +1 -1
- package/dist/types/Witness/Config.d.ts +1 -0
- package/dist/types/Witness/Config.d.ts.map +1 -1
- package/dist/types/Witness/Witness.d.ts +15 -3
- package/dist/types/Witness/Witness.d.ts.map +1 -1
- package/dist/types/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.d.ts +8 -0
- package/dist/types/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.d.ts.map +1 -0
- package/dist/types/Witness/ffmpeg/fluent/index.d.ts +2 -0
- package/dist/types/Witness/ffmpeg/fluent/index.d.ts.map +1 -0
- package/dist/types/Witness/ffmpeg/index.d.ts +3 -0
- package/dist/types/Witness/ffmpeg/index.d.ts.map +1 -0
- package/dist/types/Witness/ffmpeg/spawn/executeFfmpeg.d.ts +9 -0
- package/dist/types/Witness/ffmpeg/spawn/executeFfmpeg.d.ts.map +1 -0
- package/dist/types/Witness/ffmpeg/spawn/getVideoFrameAsImage.d.ts +8 -0
- package/dist/types/Witness/ffmpeg/spawn/getVideoFrameAsImage.d.ts.map +1 -0
- package/dist/types/Witness/ffmpeg/spawn/index.d.ts +3 -0
- package/dist/types/Witness/ffmpeg/spawn/index.d.ts.map +1 -0
- package/package.json +19 -16
- package/src/Witness/Config.ts +1 -0
- package/src/Witness/Witness.ts +98 -32
- package/src/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.ts +53 -0
- package/src/Witness/ffmpeg/fluent/index.ts +1 -0
- package/src/Witness/ffmpeg/index.ts +2 -0
- package/src/Witness/ffmpeg/spawn/executeFfmpeg.ts +31 -0
- package/src/Witness/ffmpeg/spawn/getVideoFrameAsImage.ts +11 -0
- package/src/Witness/ffmpeg/spawn/index.ts +2 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ImageThumbnailWitness = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable max-statements */
|
|
5
6
|
const node_dns_1 = require("node:dns");
|
|
6
7
|
const url_1 = require("@xylabs/url");
|
|
7
8
|
const axios_1 = require("@xyo-network/axios");
|
|
@@ -9,6 +10,7 @@ const core_1 = require("@xyo-network/core");
|
|
|
9
10
|
const image_thumbnail_payload_plugin_1 = require("@xyo-network/image-thumbnail-payload-plugin");
|
|
10
11
|
const witness_1 = require("@xyo-network/witness");
|
|
11
12
|
const async_mutex_1 = require("async-mutex");
|
|
13
|
+
const file_type_1 = tslib_1.__importDefault(require("file-type"));
|
|
12
14
|
const gm_1 = require("gm");
|
|
13
15
|
const hasbin_1 = require("hasbin");
|
|
14
16
|
const hash_wasm_1 = require("hash-wasm");
|
|
@@ -17,7 +19,9 @@ const lru_cache_1 = require("lru-cache");
|
|
|
17
19
|
const sha_js_1 = tslib_1.__importDefault(require("sha.js"));
|
|
18
20
|
const url_parse_1 = tslib_1.__importDefault(require("url-parse"));
|
|
19
21
|
const Config_1 = require("./Config");
|
|
22
|
+
const ffmpeg_1 = require("./ffmpeg");
|
|
20
23
|
//TODO: Break this into two Witnesses?
|
|
24
|
+
// setFfmpegPath(ffmpegPath)
|
|
21
25
|
const gm = (0, gm_1.subClass)({ imageMagick: '7+' });
|
|
22
26
|
class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
23
27
|
constructor() {
|
|
@@ -43,6 +47,10 @@ class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
|
43
47
|
var _a;
|
|
44
48
|
return (_a = this.config.height) !== null && _a !== void 0 ? _a : 128;
|
|
45
49
|
}
|
|
50
|
+
get ipfGateway() {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = this.config.ipfsGateway) !== null && _a !== void 0 ? _a : 'cloudflare-ipfs.com';
|
|
53
|
+
}
|
|
46
54
|
get maxAsyncProcesses() {
|
|
47
55
|
var _a;
|
|
48
56
|
return (_a = this.config.maxAsyncProcesses) !== null && _a !== void 0 ? _a : 2;
|
|
@@ -63,29 +71,6 @@ class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
|
63
71
|
var _a;
|
|
64
72
|
return (_a = this.config.width) !== null && _a !== void 0 ? _a : 128;
|
|
65
73
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Returns the equivalent IPFS gateway URL for the supplied URL.
|
|
68
|
-
* @param urlToCheck The URL to check
|
|
69
|
-
* @returns If the supplied URL is an IPFS URL, it converts the URL to the
|
|
70
|
-
* equivalent IPFS gateway URL. Otherwise, returns the original URL.
|
|
71
|
-
*/
|
|
72
|
-
static checkIpfsUrl(urlToCheck) {
|
|
73
|
-
const url = new url_1.URL(urlToCheck);
|
|
74
|
-
let protocol = url.protocol;
|
|
75
|
-
let host = url.host;
|
|
76
|
-
let path = url.pathname;
|
|
77
|
-
const query = url.search;
|
|
78
|
-
if (protocol === 'ipfs:') {
|
|
79
|
-
protocol = 'https:';
|
|
80
|
-
host = 'cloudflare-ipfs.com';
|
|
81
|
-
path = url.host === 'ipfs' ? `ipfs${path}` : `ipfs/${url.host}${path}`;
|
|
82
|
-
const root = `${protocol}//${host}/${path}`;
|
|
83
|
-
return (query === null || query === void 0 ? void 0 : query.length) > 0 ? `${root}?${query}` : root;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
return urlToCheck;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
74
|
static binaryToSha256(data) {
|
|
90
75
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
91
76
|
yield core_1.PayloadHasher.wasmInitialized;
|
|
@@ -119,6 +104,29 @@ class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
|
119
104
|
}
|
|
120
105
|
}
|
|
121
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns the equivalent IPFS gateway URL for the supplied URL.
|
|
109
|
+
* @param urlToCheck The URL to check
|
|
110
|
+
* @returns If the supplied URL is an IPFS URL, it converts the URL to the
|
|
111
|
+
* equivalent IPFS gateway URL. Otherwise, returns the original URL.
|
|
112
|
+
*/
|
|
113
|
+
checkIpfsUrl(urlToCheck) {
|
|
114
|
+
const url = new url_1.URL(urlToCheck);
|
|
115
|
+
let protocol = url.protocol;
|
|
116
|
+
let host = url.host;
|
|
117
|
+
let path = url.pathname;
|
|
118
|
+
const query = url.search;
|
|
119
|
+
if (protocol === 'ipfs:') {
|
|
120
|
+
protocol = 'https:';
|
|
121
|
+
host = this.ipfGateway;
|
|
122
|
+
path = url.host === 'ipfs' ? `ipfs${path}` : `ipfs/${url.host}${path}`;
|
|
123
|
+
const root = `${protocol}//${host}/${path}`;
|
|
124
|
+
return (query === null || query === void 0 ? void 0 : query.length) > 0 ? `${root}?${query}` : root;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return urlToCheck;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
122
130
|
observeHandler(payloads = []) {
|
|
123
131
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
124
132
|
if (!(0, hasbin_1.sync)('magick')) {
|
|
@@ -143,7 +151,7 @@ class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
|
143
151
|
}
|
|
144
152
|
else {
|
|
145
153
|
//if it is ipfs, go through cloud flair
|
|
146
|
-
const mutatedUrl =
|
|
154
|
+
const mutatedUrl = this.checkIpfsUrl(url);
|
|
147
155
|
result = yield this.fromHttp(mutatedUrl);
|
|
148
156
|
}
|
|
149
157
|
this.cache.set(url, result);
|
|
@@ -171,8 +179,19 @@ class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
|
171
179
|
return `data:image/png;base64,${thumb.toString('base64')}`;
|
|
172
180
|
});
|
|
173
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Creates an image thumbnail from a video.
|
|
184
|
+
* @param videoBuffer The input video buffer.
|
|
185
|
+
* @returns An buffer containing an image thumbnail for the video.
|
|
186
|
+
*/
|
|
187
|
+
createThumbnailFromVideo(videoBuffer) {
|
|
188
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
const imageBuffer = yield (0, ffmpeg_1.getVideoFrameAsImageFluent)(videoBuffer);
|
|
190
|
+
return this.createThumbnailDataUrl(imageBuffer);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
174
193
|
fromHttp(url) {
|
|
175
|
-
var _a, _b, _c;
|
|
194
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
176
195
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
177
196
|
let response;
|
|
178
197
|
let dnsResult;
|
|
@@ -224,17 +243,63 @@ class ImageThumbnailWitness extends witness_1.AbstractWitness {
|
|
|
224
243
|
};
|
|
225
244
|
if (response.status >= 200 && response.status < 300) {
|
|
226
245
|
const contentType = (_b = response.headers['content-type']) === null || _b === void 0 ? void 0 : _b.toString();
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
result.mime.
|
|
246
|
+
const mediaType = contentType.split('/')[0];
|
|
247
|
+
result.mime = (_c = result.mime) !== null && _c !== void 0 ? _c : {};
|
|
248
|
+
result.mime.returned = mediaType;
|
|
249
|
+
const sourceBuffer = Buffer.from(response.data, 'binary');
|
|
250
|
+
try {
|
|
251
|
+
result.mime.detected = yield file_type_1.default.fromBuffer(sourceBuffer);
|
|
233
252
|
}
|
|
234
|
-
|
|
235
|
-
const
|
|
253
|
+
catch (ex) {
|
|
254
|
+
const error = ex;
|
|
255
|
+
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.error(`FileType error: ${error.message}`);
|
|
256
|
+
}
|
|
257
|
+
const processImage = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
236
258
|
result.sourceHash = yield ImageThumbnailWitness.binaryToSha256(sourceBuffer);
|
|
237
259
|
result.url = yield this.createThumbnailDataUrl(sourceBuffer);
|
|
260
|
+
});
|
|
261
|
+
const processVideo = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
var _h;
|
|
263
|
+
// Gracefully handle the case where ffmpeg is not installed.
|
|
264
|
+
if ((0, hasbin_1.sync)('ffmpeg')) {
|
|
265
|
+
result.sourceHash = yield ImageThumbnailWitness.binaryToSha256(sourceBuffer);
|
|
266
|
+
result.url = yield this.createThumbnailFromVideo(sourceBuffer);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
result.mime = (_h = result.mime) !== null && _h !== void 0 ? _h : {};
|
|
270
|
+
result.mime.invalid = true;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
switch (mediaType) {
|
|
274
|
+
case 'image': {
|
|
275
|
+
yield processImage();
|
|
276
|
+
result.mime.type = mediaType;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case 'video': {
|
|
280
|
+
yield processVideo();
|
|
281
|
+
result.mime.type = mediaType;
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
default: {
|
|
285
|
+
switch ((_e = result.mime.detected) === null || _e === void 0 ? void 0 : _e.mime) {
|
|
286
|
+
case 'image': {
|
|
287
|
+
yield processImage();
|
|
288
|
+
result.mime.type = (_f = result.mime.detected) === null || _f === void 0 ? void 0 : _f.mime;
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case 'video': {
|
|
292
|
+
yield processVideo();
|
|
293
|
+
result.mime.type = (_g = result.mime.detected) === null || _g === void 0 ? void 0 : _g.mime;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
default: {
|
|
297
|
+
result.mime.invalid = true;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
238
303
|
}
|
|
239
304
|
}
|
|
240
305
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.js","sourceRoot":"","sources":["../../../src/Witness/Witness.ts"],"names":[],"mappings":";;;;AAAA,uCAAkD;AAElD,qCAAiC;AACjC,8CAAqE;AACrE,4CAAiD;AACjD,gGAAkG;AAElG,kDAAsD;AACtD,6CAAuC;AACvC,2BAA6B;AAC7B,mCAAuC;AACvC,yCAAkC;AAClC,qEAAoC;AACpC,yCAAoC;AACpC,4DAA0B;AAC1B,kEAA2B;AAE3B,qCAA4D;
|
|
1
|
+
{"version":3,"file":"Witness.js","sourceRoot":"","sources":["../../../src/Witness/Witness.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AACnC,uCAAkD;AAElD,qCAAiC;AACjC,8CAAqE;AACrE,4CAAiD;AACjD,gGAAkG;AAElG,kDAAsD;AACtD,6CAAuC;AACvC,kEAAgC;AAChC,2BAA6B;AAC7B,mCAAuC;AACvC,yCAAkC;AAClC,qEAAoC;AACpC,yCAAoC;AACpC,4DAA0B;AAC1B,kEAA2B;AAE3B,qCAA4D;AAC5D,qCAAqD;AAGrD,sCAAsC;AAEtC,4BAA4B;AAE5B,MAAM,EAAE,GAAG,IAAA,aAAQ,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;AAW1C,MAAa,qBAAiG,SAAQ,yBAAwB;IAA9I;;QAIU,eAAU,GAAG,IAAI,uBAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAmR5D,CAAC;IAjRC,IAAI,KAAK;;QACP,IAAI,CAAC,MAAM;YACT,MAAA,IAAI,CAAC,MAAM,mCACX,IAAI,oBAAQ,CAAyB;gBACnC,GAAG,EAAE,IAAI,CAAC,eAAe;gBACzB,OAAO,EAAE,IAAI,CAAC,aAAa;gBAC3B,qCAAqC;gBACrC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,KAAK,CAAC,GAAG,0CAAE,MAAM,mCAAI,CAAC,CAAA,EAAA;aACnD,CAAC,CAAA;QACJ,OAAO,IAAI,CAAC,MAAM,CAA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AO,CAAC,CAAC;wBACZ,MAAM,YAAY,EAAE,CAAA;wBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;wBAC5B,MAAK;qBACN;oBACD,KAAK,OAAO,CAAC,CAAC;wBACZ,MAAM,YAAY,EAAE,CAAA;wBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;wBAC5B,MAAK;qBACN;oBACD,OAAO,CAAC,CAAC;wBACP,QAAQ,MAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,0CAAE,IAAI,EAAE;4BAClC,KAAK,OAAO,CAAC,CAAC;gCACZ,MAAM,YAAY,EAAE,CAAA;gCACpB,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAA;gCAC7C,MAAK;6BACN;4BACD,KAAK,OAAO,CAAC,CAAC;gCACZ,MAAM,YAAY,EAAE,CAAA;gCACpB,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAA;gCAC7C,MAAK;6BACN;4BACD,OAAO,CAAC,CAAC;gCACP,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;gCAC1B,MAAK;6BACN;yBACF;wBACD,MAAK;qBACN;iBACF;aACF;YACD,OAAO,MAAM,CAAA;;KACd;;AAtRH,sDAuRC;AAtRiB,mCAAa,GAAG,CAAC,0CAAiC,CAAC,AAAtC,CAAsC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVideoFrameAsImageFluent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fluent_ffmpeg_1 = tslib_1.__importDefault(require("fluent-ffmpeg"));
|
|
6
|
+
const stream_1 = require("stream");
|
|
7
|
+
/**
|
|
8
|
+
* Execute FFmpeg using fluent API with provided input buffer and video thumbnail image.
|
|
9
|
+
* @param videoBuffer Input video buffer.
|
|
10
|
+
* @returns Output buffer containing the video thumbnail image.
|
|
11
|
+
*/
|
|
12
|
+
const getVideoFrameAsImageFluent = (videoBuffer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const imageBuffer = yield new Promise((resolve, reject) => {
|
|
14
|
+
// const videoStream = new PassThrough()
|
|
15
|
+
// videoStream.end(videoBuffer)
|
|
16
|
+
const videoStream = new stream_1.Readable();
|
|
17
|
+
videoStream._read = () => { }; // _read is required but you can noop it
|
|
18
|
+
videoStream.push(videoBuffer);
|
|
19
|
+
videoStream.push(null);
|
|
20
|
+
// Initialize empty array to collect PNG chunks
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
const pngChunks = [];
|
|
23
|
+
// Create a Writable stream to collect PNG output from ffmpeg
|
|
24
|
+
const writableStream = new stream_1.Writable({
|
|
25
|
+
write(chunk, encoding, callback) {
|
|
26
|
+
pngChunks.push(chunk);
|
|
27
|
+
callback();
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const command = (0, fluent_ffmpeg_1.default)()
|
|
31
|
+
// Uncomment to debug CLI args to ffmpeg
|
|
32
|
+
// .on('start', (commandLine) => console.log('Spawned Ffmpeg with command: ' + commandLine))
|
|
33
|
+
.input(videoStream)
|
|
34
|
+
.takeFrames(1)
|
|
35
|
+
.withNoAudio()
|
|
36
|
+
// Exactly as their docs but does not work
|
|
37
|
+
// .setStartTime('00:00:00')
|
|
38
|
+
// .seekInput(0)
|
|
39
|
+
.on('error', (err) => reject(err.message))
|
|
40
|
+
// Listen for the 'end' event to combine the chunks and create a PNG buffer
|
|
41
|
+
.on('end', () => resolve(Buffer.concat(pngChunks)))
|
|
42
|
+
.on('data', (chunk) => pngChunks.push(chunk))
|
|
43
|
+
// .toFormat('png')
|
|
44
|
+
.outputOptions('-f image2pipe');
|
|
45
|
+
// .outputOptions('-vcodec png')
|
|
46
|
+
// .output(writableStream, { end: true })
|
|
47
|
+
// Start processing
|
|
48
|
+
command.pipe(writableStream);
|
|
49
|
+
});
|
|
50
|
+
return imageBuffer;
|
|
51
|
+
});
|
|
52
|
+
exports.getVideoFrameAsImageFluent = getVideoFrameAsImageFluent;
|
|
53
|
+
//# sourceMappingURL=getVideoFrameAsImageFluent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVideoFrameAsImageFluent.js","sourceRoot":"","sources":["../../../../../src/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.ts"],"names":[],"mappings":";;;;AAAA,0EAAkC;AAClC,mCAA2C;AAE3C;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAO,WAAmB,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAChE,wCAAwC;QACxC,+BAA+B;QAE/B,MAAM,WAAW,GAAG,IAAI,iBAAQ,EAAE,CAAA;QAClC,WAAW,CAAC,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA,CAAC,wCAAwC;QACrE,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC7B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEtB,+CAA+C;QAC/C,8DAA8D;QAC9D,MAAM,SAAS,GAAU,EAAE,CAAA;QAE3B,6DAA6D;QAC7D,MAAM,cAAc,GAAG,IAAI,iBAAQ,CAAC;YAClC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;gBAC7B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACrB,QAAQ,EAAE,CAAA;YACZ,CAAC;SACF,CAAC,CAAA;QAEF,MAAM,OAAO,GAAG,IAAA,uBAAM,GAAE;YACtB,wCAAwC;YACxC,4FAA4F;aAC3F,KAAK,CAAC,WAAW,CAAC;aAClB,UAAU,CAAC,CAAC,CAAC;aACb,WAAW,EAAE;YACd,0CAA0C;YAC1C,4BAA4B;YAC5B,gBAAgB;aACf,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1C,2EAA2E;aAC1E,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;aAClD,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7C,mBAAmB;aAClB,aAAa,CAAC,eAAe,CAAC,CAAA;QACjC,gCAAgC;QAChC,yCAAyC;QAEzC,mBAAmB;QACnB,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA,CAAA;AA5CY,QAAA,0BAA0B,8BA4CtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/Witness/ffmpeg/fluent/index.ts"],"names":[],"mappings":";;;AAAA,uEAA4C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Witness/ffmpeg/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwB;AACxB,kDAAuB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeFFmpeg = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const stream_1 = require("stream");
|
|
6
|
+
/**
|
|
7
|
+
* Execute FFmpeg with the provided arguments.
|
|
8
|
+
* @param videoBuffer Input video buffer.
|
|
9
|
+
* @param ffmpegArgs FFmpeg arguments.
|
|
10
|
+
* @returns Output buffer containing the video thumbnail image.
|
|
11
|
+
*/
|
|
12
|
+
const executeFFmpeg = (videoBuffer, ffmpegArgs) => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const ffmpeg = (0, child_process_1.spawn)('ffmpeg', ffmpegArgs);
|
|
15
|
+
// Create a readable stream from the input buffer
|
|
16
|
+
const videoStream = new stream_1.PassThrough().end(videoBuffer);
|
|
17
|
+
// Pipe the input stream to ffmpeg's stdin
|
|
18
|
+
videoStream.pipe(ffmpeg.stdin);
|
|
19
|
+
const chunks = [];
|
|
20
|
+
ffmpeg.stdout.on('data', (chunk) => chunks.push(chunk));
|
|
21
|
+
// TODO: This is required as we're seeing errors thrown due to
|
|
22
|
+
// how we're piping the data to ffmpeg. Works perfectly though.
|
|
23
|
+
ffmpeg.stdin.on('error', () => { });
|
|
24
|
+
ffmpeg.on('close', (code) => {
|
|
25
|
+
if (code !== 0) {
|
|
26
|
+
return reject(new Error(`FFmpeg exited with code ${code}`));
|
|
27
|
+
}
|
|
28
|
+
resolve(Buffer.concat(chunks));
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.executeFFmpeg = executeFFmpeg;
|
|
33
|
+
//# sourceMappingURL=executeFfmpeg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeFfmpeg.js","sourceRoot":"","sources":["../../../../../src/Witness/ffmpeg/spawn/executeFfmpeg.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AACrC,mCAAoC;AAEpC;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAC,WAAmB,EAAE,UAAoB,EAAmB,EAAE;IAC1F,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,IAAA,qBAAK,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAE1C,iDAAiD;QACjD,MAAM,WAAW,GAAG,IAAI,oBAAW,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;QAEtD,0CAA0C;QAC1C,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC9B,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;QAC/D,8DAA8D;QAC9D,+DAA+D;QAC/D,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAClC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAC1B,IAAI,IAAI,KAAK,CAAC,EAAE;gBACd,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC,CAAA;aAC5D;YACD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QAChC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AArBY,QAAA,aAAa,iBAqBzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVideoFrameAsImage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const executeFfmpeg_1 = require("./executeFfmpeg");
|
|
6
|
+
/**
|
|
7
|
+
* Execute FFmpeg with provided input buffer and return video thumbnail image.
|
|
8
|
+
* @param videoBuffer Input video buffer.
|
|
9
|
+
* @returns Output buffer containing the video thumbnail image.
|
|
10
|
+
*/
|
|
11
|
+
const getVideoFrameAsImage = (videoBuffer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const imageBuffer = yield (0, executeFfmpeg_1.executeFFmpeg)(videoBuffer, ['-i', 'pipe:', '-ss', '00:00:00', '-vframes', '1', '-f', 'image2pipe', '-']);
|
|
13
|
+
return imageBuffer;
|
|
14
|
+
});
|
|
15
|
+
exports.getVideoFrameAsImage = getVideoFrameAsImage;
|
|
16
|
+
//# sourceMappingURL=getVideoFrameAsImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVideoFrameAsImage.js","sourceRoot":"","sources":["../../../../../src/Witness/ffmpeg/spawn/getVideoFrameAsImage.ts"],"names":[],"mappings":";;;;AAAA,mDAA+C;AAE/C;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAAO,WAAmB,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAa,EAAC,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,CAAA;IAClI,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA,CAAA;AAHY,QAAA,oBAAoB,wBAGhC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./executeFfmpeg"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./getVideoFrameAsImage"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/Witness/ffmpeg/spawn/index.ts"],"names":[],"mappings":";;;AAAA,0DAA+B;AAC/B,iEAAsC"}
|