@modernized/fluent-ffmpeg 0.1.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.
Files changed (79) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +1481 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +7 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/lib/capabilities.d.ts +4 -0
  8. package/dist/lib/capabilities.d.ts.map +1 -0
  9. package/dist/lib/capabilities.js +354 -0
  10. package/dist/lib/capabilities.js.map +1 -0
  11. package/dist/lib/ffprobe.d.ts +4 -0
  12. package/dist/lib/ffprobe.d.ts.map +1 -0
  13. package/dist/lib/ffprobe.js +185 -0
  14. package/dist/lib/ffprobe.js.map +1 -0
  15. package/dist/lib/fluent-ffmpeg.d.ts +29 -0
  16. package/dist/lib/fluent-ffmpeg.d.ts.map +1 -0
  17. package/dist/lib/fluent-ffmpeg.js +145 -0
  18. package/dist/lib/fluent-ffmpeg.js.map +1 -0
  19. package/dist/lib/options/audio.d.ts +4 -0
  20. package/dist/lib/options/audio.d.ts.map +1 -0
  21. package/dist/lib/options/audio.js +48 -0
  22. package/dist/lib/options/audio.js.map +1 -0
  23. package/dist/lib/options/custom.d.ts +4 -0
  24. package/dist/lib/options/custom.d.ts.map +1 -0
  25. package/dist/lib/options/custom.js +61 -0
  26. package/dist/lib/options/custom.js.map +1 -0
  27. package/dist/lib/options/inputs.d.ts +4 -0
  28. package/dist/lib/options/inputs.d.ts.map +1 -0
  29. package/dist/lib/options/inputs.js +96 -0
  30. package/dist/lib/options/inputs.js.map +1 -0
  31. package/dist/lib/options/misc.d.ts +4 -0
  32. package/dist/lib/options/misc.d.ts.map +1 -0
  33. package/dist/lib/options/misc.js +37 -0
  34. package/dist/lib/options/misc.js.map +1 -0
  35. package/dist/lib/options/output.d.ts +4 -0
  36. package/dist/lib/options/output.d.ts.map +1 -0
  37. package/dist/lib/options/output.js +88 -0
  38. package/dist/lib/options/output.js.map +1 -0
  39. package/dist/lib/options/video.d.ts +4 -0
  40. package/dist/lib/options/video.d.ts.map +1 -0
  41. package/dist/lib/options/video.js +63 -0
  42. package/dist/lib/options/video.js.map +1 -0
  43. package/dist/lib/options/videosize.d.ts +4 -0
  44. package/dist/lib/options/videosize.d.ts.map +1 -0
  45. package/dist/lib/options/videosize.js +162 -0
  46. package/dist/lib/options/videosize.js.map +1 -0
  47. package/dist/lib/presets/divx.d.ts +3 -0
  48. package/dist/lib/presets/divx.d.ts.map +1 -0
  49. package/dist/lib/presets/divx.js +16 -0
  50. package/dist/lib/presets/divx.js.map +1 -0
  51. package/dist/lib/presets/flashvideo.d.ts +3 -0
  52. package/dist/lib/presets/flashvideo.d.ts.map +1 -0
  53. package/dist/lib/presets/flashvideo.js +18 -0
  54. package/dist/lib/presets/flashvideo.js.map +1 -0
  55. package/dist/lib/presets/podcast.d.ts +3 -0
  56. package/dist/lib/presets/podcast.d.ts.map +1 -0
  57. package/dist/lib/presets/podcast.js +34 -0
  58. package/dist/lib/presets/podcast.js.map +1 -0
  59. package/dist/lib/presets/types.d.ts +15 -0
  60. package/dist/lib/presets/types.d.ts.map +1 -0
  61. package/dist/lib/presets/types.js +3 -0
  62. package/dist/lib/presets/types.js.map +1 -0
  63. package/dist/lib/processor.d.ts +4 -0
  64. package/dist/lib/processor.d.ts.map +1 -0
  65. package/dist/lib/processor.js +378 -0
  66. package/dist/lib/processor.js.map +1 -0
  67. package/dist/lib/recipes.d.ts +4 -0
  68. package/dist/lib/recipes.d.ts.map +1 -0
  69. package/dist/lib/recipes.js +291 -0
  70. package/dist/lib/recipes.js.map +1 -0
  71. package/dist/lib/types.d.ts +198 -0
  72. package/dist/lib/types.d.ts.map +1 -0
  73. package/dist/lib/types.js +3 -0
  74. package/dist/lib/types.js.map +1 -0
  75. package/dist/lib/utils.d.ts +26 -0
  76. package/dist/lib/utils.d.ts.map +1 -0
  77. package/dist/lib/utils.js +292 -0
  78. package/dist/lib/utils.js.map +1 -0
  79. package/package.json +58 -0
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const node_events_1 = require("node:events");
6
+ const node_path_1 = __importDefault(require("node:path"));
7
+ const utils_js_1 = __importDefault(require("./utils.js"));
8
+ const inputs_js_1 = __importDefault(require("./options/inputs.js"));
9
+ const audio_js_1 = __importDefault(require("./options/audio.js"));
10
+ const video_js_1 = __importDefault(require("./options/video.js"));
11
+ const videosize_js_1 = __importDefault(require("./options/videosize.js"));
12
+ const output_js_1 = __importDefault(require("./options/output.js"));
13
+ const custom_js_1 = __importDefault(require("./options/custom.js"));
14
+ const misc_js_1 = __importDefault(require("./options/misc.js"));
15
+ const processor_js_1 = __importDefault(require("./processor.js"));
16
+ const capabilities_js_1 = __importDefault(require("./capabilities.js"));
17
+ const ffprobe_js_1 = __importDefault(require("./ffprobe.js"));
18
+ const recipes_js_1 = __importDefault(require("./recipes.js"));
19
+ const DEFAULT_STDOUT_LINES = 100;
20
+ const NULL_LOGGER = {
21
+ debug: () => { },
22
+ info: () => { },
23
+ warn: () => { },
24
+ error: () => { },
25
+ };
26
+ function isOptionsObject(value) {
27
+ return typeof value === 'object' && value !== null && !('readable' in value);
28
+ }
29
+ function applyDefaults(options) {
30
+ options.stdoutLines = 'stdoutLines' in options ? options.stdoutLines : DEFAULT_STDOUT_LINES;
31
+ // Legacy used `||` (falsy fallback). Keep that exactly so '' presets and
32
+ // niceness:0 with a priority set still inherit the right value.
33
+ options.presets = options.presets || options.preset || node_path_1.default.join(__dirname, 'presets');
34
+ options.niceness = options.niceness || options.priority || 0;
35
+ }
36
+ function FfmpegCommandImpl(input, options) {
37
+ if (!(this instanceof FfmpegCommand)) {
38
+ return new FfmpegCommand(input, options);
39
+ }
40
+ node_events_1.EventEmitter.call(this);
41
+ let opts;
42
+ if (isOptionsObject(input)) {
43
+ opts = input;
44
+ }
45
+ else {
46
+ // Match legacy: unconditional source assignment, including undefined,
47
+ // so `new FfmpegCommand(undefined, { source: 'foo' })` clears `source`
48
+ // exactly the way the legacy constructor did.
49
+ opts = options ?? {};
50
+ opts.source = input;
51
+ }
52
+ this._inputs = [];
53
+ if (opts.source)
54
+ this.input(opts.source);
55
+ this._outputs = [];
56
+ this.output();
57
+ this._global = utils_js_1.default.args();
58
+ this._complexFilters = utils_js_1.default.args();
59
+ applyDefaults(opts);
60
+ this.options = opts;
61
+ // Legacy used `||`: any falsy logger (false / '' / 0 / null / undefined)
62
+ // falls back to the no-op logger so internal .debug/.warn calls don't crash.
63
+ this.logger = opts.logger || NULL_LOGGER;
64
+ return undefined;
65
+ }
66
+ const FfmpegCommand = FfmpegCommandImpl;
67
+ Object.setPrototypeOf(FfmpegCommand.prototype, node_events_1.EventEmitter.prototype);
68
+ const proto = FfmpegCommand.prototype;
69
+ (0, inputs_js_1.default)(proto);
70
+ (0, audio_js_1.default)(proto);
71
+ (0, video_js_1.default)(proto);
72
+ (0, videosize_js_1.default)(proto);
73
+ (0, output_js_1.default)(proto);
74
+ (0, custom_js_1.default)(proto);
75
+ (0, misc_js_1.default)(proto);
76
+ (0, processor_js_1.default)(proto);
77
+ (0, capabilities_js_1.default)(proto);
78
+ (0, ffprobe_js_1.default)(proto);
79
+ (0, recipes_js_1.default)(proto);
80
+ function cloneFirstOutput(src) {
81
+ if (!src)
82
+ return undefined;
83
+ const dest = {
84
+ flags: { ...src.flags },
85
+ audio: src.audio.clone(),
86
+ audioFilters: src.audioFilters.clone(),
87
+ video: src.video.clone(),
88
+ videoFilters: src.videoFilters.clone(),
89
+ sizeFilters: src.sizeFilters.clone(),
90
+ options: src.options.clone(),
91
+ };
92
+ if (src.sizeData)
93
+ dest.sizeData = { ...src.sizeData };
94
+ return dest;
95
+ }
96
+ FfmpegCommand.prototype.clone = function () {
97
+ const c = new FfmpegCommand();
98
+ c.options = this.options;
99
+ c.logger = this.logger;
100
+ c._inputs = this._inputs.map((input) => ({
101
+ source: input.source,
102
+ isFile: input.isFile,
103
+ isStream: input.isStream,
104
+ options: input.options.clone(),
105
+ }));
106
+ if (this._outputs[0] && 'target' in this._outputs[0]) {
107
+ c._outputs = [];
108
+ c.output();
109
+ }
110
+ else {
111
+ const cloned = cloneFirstOutput(this._outputs[0]);
112
+ c._outputs = [cloned];
113
+ c._currentOutput = cloned;
114
+ }
115
+ c._global = this._global.clone();
116
+ c._complexFilters = this._complexFilters.clone();
117
+ return c;
118
+ };
119
+ FfmpegCommand.setFfmpegPath = (p) => {
120
+ new FfmpegCommand().setFfmpegPath(p);
121
+ };
122
+ FfmpegCommand.setFfprobePath = (p) => {
123
+ new FfmpegCommand().setFfprobePath(p);
124
+ };
125
+ FfmpegCommand.setFlvtoolPath = (p) => {
126
+ new FfmpegCommand().setFlvtoolPath(p);
127
+ };
128
+ FfmpegCommand.availableFilters = FfmpegCommand.getAvailableFilters = (cb) => {
129
+ new FfmpegCommand().availableFilters(cb);
130
+ };
131
+ FfmpegCommand.availableCodecs = FfmpegCommand.getAvailableCodecs = (cb) => {
132
+ new FfmpegCommand().availableCodecs(cb);
133
+ };
134
+ FfmpegCommand.availableFormats = FfmpegCommand.getAvailableFormats = (cb) => {
135
+ new FfmpegCommand().availableFormats(cb);
136
+ };
137
+ FfmpegCommand.availableEncoders = FfmpegCommand.getAvailableEncoders = (cb) => {
138
+ new FfmpegCommand().availableEncoders(cb);
139
+ };
140
+ FfmpegCommand.ffprobe = function (file, ...args) {
141
+ const inst = new FfmpegCommand(file);
142
+ inst.ffprobe(...args);
143
+ };
144
+ module.exports = FfmpegCommand;
145
+ //# sourceMappingURL=fluent-ffmpeg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluent-ffmpeg.js","sourceRoot":"","sources":["../../lib/fluent-ffmpeg.ts"],"names":[],"mappings":";;;;AAAA,6CAA2C;AAC3C,0DAA6B;AAG7B,0DAA+B;AAC/B,oEAA8C;AAC9C,kEA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CAAC;AAC3C,CAAC,CAAC;AACF,aAAa,CAAC,eAAe,GAAG,aAAa,CAAC,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE;IACxE,IAAI,aAAa,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC;AACF,aAAa,CAAC,gBAAgB,GAAG,aAAa,CAAC,mBAAmB,GAAG,CAAC,EAAE,EAAE,EAAE;IAC1E,IAAI,aAAa,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC;AACF,aAAa,CAAC,iBAAiB,GAAG,aAAa,CAAC,oBAAoB,GAAG,CAAC,EAAE,EAAE,EAAE;IAC5E,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC;AACF,aAAa,CAAC,OAAO,GAAG,UAAU,IAAY,EAAE,GAAG,IAAe;IAChE,MAAM,IAAI,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,OAAqC,CAAC,GAAG,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,iBAAS,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FfmpegCommandPrototype } from '../types.js';
2
+ declare function applyAudioOptions(proto: FfmpegCommandPrototype): void;
3
+ export = applyAudioOptions;
4
+ //# sourceMappingURL=audio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../../lib/options/audio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,aAAa,CAAC;AAEzF,iBAAS,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CA8D9D;AAED,SAAS,iBAAiB,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const utils_js_1 = __importDefault(require("../utils.js"));
6
+ function applyAudioOptions(proto) {
7
+ proto.withNoAudio = proto.noAudio = function () {
8
+ this._currentOutput.audio.clear();
9
+ this._currentOutput.audioFilters.clear();
10
+ this._currentOutput.audio('-an');
11
+ return this;
12
+ };
13
+ proto.withAudioCodec = proto.audioCodec = function (codec) {
14
+ this._currentOutput.audio('-acodec', codec);
15
+ return this;
16
+ };
17
+ proto.withAudioBitrate = proto.audioBitrate = function (bitrate) {
18
+ this._currentOutput.audio('-b:a', String(bitrate).replace(/k?$/, 'k'));
19
+ return this;
20
+ };
21
+ proto.withAudioChannels = proto.audioChannels = function (channels) {
22
+ this._currentOutput.audio('-ac', channels);
23
+ return this;
24
+ };
25
+ proto.withAudioFrequency = proto.audioFrequency = function (freq) {
26
+ this._currentOutput.audio('-ar', freq);
27
+ return this;
28
+ };
29
+ proto.withAudioQuality = proto.audioQuality = function (quality) {
30
+ this._currentOutput.audio('-aq', quality);
31
+ return this;
32
+ };
33
+ proto.withAudioFilter =
34
+ proto.withAudioFilters =
35
+ proto.audioFilter =
36
+ proto.audioFilters =
37
+ function (...rest) {
38
+ const flat = rest.length > 1
39
+ ? rest
40
+ : Array.isArray(rest[0])
41
+ ? rest[0]
42
+ : [rest[0]];
43
+ this._currentOutput.audioFilters(utils_js_1.default.makeFilterStrings(flat));
44
+ return this;
45
+ };
46
+ }
47
+ module.exports = applyAudioOptions;
48
+ //# sourceMappingURL=audio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio.js","sourceRoot":"","sources":["../../../lib/options/audio.ts"],"names":[],"mappings":";;;;AAAA,2DAAgC;AAGhC,SAAS,iBAAiB,CAAC,KAA6B;IACtD,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,OAAO,GAAG;QAClC,IAAI,CAAC,cAAe,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,cAAe,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1C,I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,CAAC,MAAM,GAAG,CAAC;4BACb,CAAC,CAAE,IAAgC;4BACnC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gCACtB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gCACT,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClB,IAAI,CAAC,cAAe,CAAC,YAAY,CAAC,kBAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;wBACjE,OAAO,IAAI,CAAC;oBACd,CAAC,CAAC;AACR,CAAC;AAED,iBAAS,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FfmpegCommandPrototype } from '../types.js';
2
+ declare function applyCustomOptions(proto: FfmpegCommandPrototype): void;
3
+ export = applyCustomOptions;
4
+ //# sourceMappingURL=custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../lib/options/custom.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,aAAa,CAAC;AAezF,iBAAS,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAgD/D;AAED,SAAS,kBAAkB,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const utils_js_1 = __importDefault(require("../utils.js"));
6
+ function flattenOptions(args, doSplit) {
7
+ const list = args.length > 1 ? args : Array.isArray(args[0]) ? args[0] : [args[0]];
8
+ return list.reduce((acc, option) => {
9
+ const split = String(option).split(' ');
10
+ if (doSplit && split.length === 2) {
11
+ acc.push(split[0], split[1]);
12
+ }
13
+ else {
14
+ acc.push(option);
15
+ }
16
+ return acc;
17
+ }, []);
18
+ }
19
+ function applyCustomOptions(proto) {
20
+ proto.addInputOption =
21
+ proto.addInputOptions =
22
+ proto.withInputOption =
23
+ proto.withInputOptions =
24
+ proto.inputOption =
25
+ proto.inputOptions =
26
+ function (...rest) {
27
+ if (!this._currentInput) {
28
+ throw new Error('No input specified');
29
+ }
30
+ const doSplit = rest.length === 1;
31
+ this._currentInput.options(flattenOptions(rest, doSplit));
32
+ return this;
33
+ };
34
+ proto.addOutputOption =
35
+ proto.addOutputOptions =
36
+ proto.addOption =
37
+ proto.addOptions =
38
+ proto.withOutputOption =
39
+ proto.withOutputOptions =
40
+ proto.withOption =
41
+ proto.withOptions =
42
+ proto.outputOption =
43
+ proto.outputOptions =
44
+ function (...rest) {
45
+ const doSplit = rest.length === 1;
46
+ this._currentOutput.options(flattenOptions(rest, doSplit));
47
+ return this;
48
+ };
49
+ proto.filterGraph = proto.complexFilter = function (spec, map) {
50
+ this._complexFilters.clear();
51
+ const specs = Array.isArray(spec) ? spec : [spec];
52
+ this._complexFilters('-filter_complex', utils_js_1.default.makeFilterStrings(specs).join(';'));
53
+ const mapList = Array.isArray(map) ? map : typeof map === 'string' ? [map] : [];
54
+ mapList.forEach((streamSpec) => {
55
+ this._complexFilters('-map', streamSpec.replace(utils_js_1.default.streamRegexp, '[$1]'));
56
+ });
57
+ return this;
58
+ };
59
+ }
60
+ module.exports = applyCustomOptions;
61
+ //# sourceMappingURL=custom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.js","sourceRoot":"","sources":["../../../lib/options/custom.ts"],"names":[],"mappings":";;;;AAAA,2DAAgC;AAGhC,SAAS,cAAc,CAAC,IAA2B,EAAE,OAAgB;IACnE,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,IAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACjG,OAAO,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C,aAAa;4CACjB,UAAmC,GAAG,IAA2B;gDAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;gDAClC,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;gDAC5D,OAAO,IAAI,CAAC;4CACd,CAAC,CAAC;IAEN,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,aAAa,GAAG,UAExC,IAAmD,EACnD,GAAuB;QAEvB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,MAAM,KAAK,GAA4B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,kBAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAElF,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC7B,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,kBAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,iBAAS,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FfmpegCommandPrototype } from '../types.js';
2
+ declare function applyInputsOptions(proto: FfmpegCommandPrototype): void;
3
+ export = applyInputsOptions;
4
+ //# sourceMappingURL=inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../lib/options/inputs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,aAAa,CAAC;AAiBzF,iBAAS,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAkF/D;AAED,SAAS,kBAAkB,CAAC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const utils_js_1 = __importDefault(require("../utils.js"));
6
+ function isReadable(value) {
7
+ return typeof value === 'object' && value !== null && 'readable' in value;
8
+ }
9
+ function classifySource(source) {
10
+ if (typeof source === 'string') {
11
+ const protocol = source.match(/^([a-z]{2,}):/i);
12
+ return { isFile: !protocol || protocol[0] === 'file', isStream: false };
13
+ }
14
+ if (!isReadable(source) || !source.readable) {
15
+ throw new Error('Invalid input');
16
+ }
17
+ return { isFile: false, isStream: true };
18
+ }
19
+ function applyInputsOptions(proto) {
20
+ proto.mergeAdd =
21
+ proto.addInput =
22
+ proto.input =
23
+ function (source) {
24
+ const { isFile, isStream } = classifySource(source);
25
+ if (isStream) {
26
+ const hasInputStream = this._inputs.some((input) => input.isStream);
27
+ if (hasInputStream) {
28
+ throw new Error('Only one input stream is supported');
29
+ }
30
+ source.pause();
31
+ }
32
+ const newInput = {
33
+ source,
34
+ isFile,
35
+ isStream,
36
+ options: utils_js_1.default.args(),
37
+ };
38
+ this._currentInput = newInput;
39
+ this._inputs.push(newInput);
40
+ return this;
41
+ };
42
+ proto.withInputFormat =
43
+ proto.inputFormat =
44
+ proto.fromFormat =
45
+ function (format) {
46
+ if (!this._currentInput) {
47
+ throw new Error('No input specified');
48
+ }
49
+ this._currentInput.options('-f', format);
50
+ return this;
51
+ };
52
+ proto.withInputFps =
53
+ proto.withInputFPS =
54
+ proto.withFpsInput =
55
+ proto.withFPSInput =
56
+ proto.inputFPS =
57
+ proto.inputFps =
58
+ proto.fpsInput =
59
+ proto.FPSInput =
60
+ function (fps) {
61
+ if (!this._currentInput) {
62
+ throw new Error('No input specified');
63
+ }
64
+ this._currentInput.options('-r', fps);
65
+ return this;
66
+ };
67
+ proto.nativeFramerate =
68
+ proto.withNativeFramerate =
69
+ proto.native =
70
+ function () {
71
+ if (!this._currentInput) {
72
+ throw new Error('No input specified');
73
+ }
74
+ this._currentInput.options('-re');
75
+ return this;
76
+ };
77
+ proto.setStartTime = proto.seekInput = function (seek) {
78
+ if (!this._currentInput) {
79
+ throw new Error('No input specified');
80
+ }
81
+ this._currentInput.options('-ss', seek);
82
+ return this;
83
+ };
84
+ proto.loop = function (duration) {
85
+ if (!this._currentInput) {
86
+ throw new Error('No input specified');
87
+ }
88
+ this._currentInput.options('-loop', '1');
89
+ if (duration !== undefined) {
90
+ this.duration(duration);
91
+ }
92
+ return this;
93
+ };
94
+ }
95
+ module.exports = applyInputsOptions;
96
+ //# sourceMappingURL=inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../lib/options/inputs.ts"],"names":[],"mappings":";;;;AACA,2DAAgC;AAGhC,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,UAAU,IAAI,KAAK,CAAC;AAC5E,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAChD,OAAO,EAAE,MAAM,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC1E,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC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CAAC;QACxC,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,iBAAS,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FfmpegCommandPrototype } from '../types.js';
2
+ declare function applyMiscOptions(proto: FfmpegCommandPrototype): void;
3
+ export = applyMiscOptions;
4
+ //# sourceMappingURL=misc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../lib/options/misc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAqB,MAAM,aAAa,CAAC;AAuB7E,iBAAS,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAY7D;AAED,SAAS,gBAAgB,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const node_path_1 = __importDefault(require("node:path"));
6
+ const node_module_1 = require("node:module");
7
+ const requireFromHere = (0, node_module_1.createRequire)(__filename);
8
+ function loadPresetByName(preset) {
9
+ const modulePath = node_path_1.default.join(this.options.presets ?? '', preset);
10
+ // Match legacy: a single try/catch wraps both the require AND the load() call,
11
+ // so any failure surfaces as 'preset <path> could not be loaded: ...'.
12
+ try {
13
+ const mod = requireFromHere(modulePath);
14
+ if (typeof mod.load !== 'function') {
15
+ throw new Error(`preset ${modulePath} has no load() function`);
16
+ }
17
+ mod.load(this);
18
+ }
19
+ catch (err) {
20
+ throw new Error(`preset ${modulePath} could not be loaded: ${err.message}`, {
21
+ cause: err,
22
+ });
23
+ }
24
+ }
25
+ function applyMiscOptions(proto) {
26
+ proto.usingPreset = proto.preset = function (preset) {
27
+ if (typeof preset === 'function') {
28
+ preset(this);
29
+ }
30
+ else {
31
+ loadPresetByName.call(this, preset);
32
+ }
33
+ return this;
34
+ };
35
+ }
36
+ module.exports = applyMiscOptions;
37
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../lib/options/misc.ts"],"names":[],"mappings":";;;;AAAA,0DAA6B;AAC7B,6CAA4C;AAG5C,MAAM,eAAe,GAAG,IAAA,2BAAa,EAAC,UAAU,CAAC,CAAC;AAIlD,SAAS,gBAAgB,CAA0B,MAAc;IAC/D,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACjE,+EAA+E;IAC/E,uEAAuE;IACvE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,eAAe,CAAC,UAAU,CAAiB,CAAC;QACxD,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,UAAU,UAAU,yBAAyB,CAAC,CAAC;QACjE,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,UAAU,UAAU,yBAA0B,GAAa,CAAC,OAAO,EAAE,EAAE;YACrF,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,KAA6B;IACrD,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,UAEjC,MAAmD;QAEnD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,iBAAS,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FfmpegCommandPrototype } from '../types.js';
2
+ declare function applyOutputOptions(proto: FfmpegCommandPrototype): void;
3
+ export = applyOutputOptions;
4
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../lib/options/output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAkC,MAAM,aAAa,CAAC;AAqC1F,iBAAS,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAkE/D;AAED,SAAS,kBAAkB,CAAC"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const utils_js_1 = __importDefault(require("../utils.js"));
6
+ function isWritable(value) {
7
+ return typeof value === 'object' && value !== null && 'writable' in value;
8
+ }
9
+ function makeOutputState(target, isFile = false, pipeopts = {}) {
10
+ const state = {
11
+ isFile,
12
+ pipeopts,
13
+ audio: utils_js_1.default.args(),
14
+ audioFilters: utils_js_1.default.args(),
15
+ video: utils_js_1.default.args(),
16
+ videoFilters: utils_js_1.default.args(),
17
+ sizeFilters: utils_js_1.default.args(),
18
+ options: utils_js_1.default.args(),
19
+ flags: {},
20
+ };
21
+ if (target !== undefined)
22
+ state.target = target;
23
+ return state;
24
+ }
25
+ function classifyOutput(target) {
26
+ if (typeof target === 'string') {
27
+ const protocol = target.match(/^([a-z]{2,}):/i);
28
+ return { isFile: !protocol || protocol[0] === 'file' };
29
+ }
30
+ if (!isWritable(target) || !target.writable) {
31
+ throw new Error('Invalid output');
32
+ }
33
+ return { isFile: false };
34
+ }
35
+ function applyOutputOptions(proto) {
36
+ proto.addOutput = proto.output = function (target, pipeopts) {
37
+ if (!target && this._currentOutput !== undefined) {
38
+ throw new Error('Invalid output');
39
+ }
40
+ const { isFile } = target ? classifyOutput(target) : { isFile: false };
41
+ const current = this._currentOutput;
42
+ if (target && current && !('target' in current)) {
43
+ current.target = target;
44
+ current.isFile = isFile;
45
+ current.pipeopts = pipeopts ?? {};
46
+ return this;
47
+ }
48
+ if (target && typeof target !== 'string') {
49
+ const hasOutputStream = this._outputs.some((output) => output.target !== undefined && typeof output.target !== 'string');
50
+ if (hasOutputStream) {
51
+ throw new Error('Only one output stream is supported');
52
+ }
53
+ }
54
+ const newOutput = makeOutputState(target, isFile, pipeopts ?? {});
55
+ this._currentOutput = newOutput;
56
+ this._outputs.push(newOutput);
57
+ return this;
58
+ };
59
+ proto.seekOutput = proto.seek = function (seek) {
60
+ this._currentOutput.options('-ss', seek);
61
+ return this;
62
+ };
63
+ proto.withDuration =
64
+ proto.setDuration =
65
+ proto.duration =
66
+ function (duration) {
67
+ this._currentOutput.options('-t', duration);
68
+ return this;
69
+ };
70
+ proto.toFormat =
71
+ proto.withOutputFormat =
72
+ proto.outputFormat =
73
+ proto.format =
74
+ function (format) {
75
+ this._currentOutput.options('-f', format);
76
+ return this;
77
+ };
78
+ proto.map = function (spec) {
79
+ this._currentOutput.options('-map', spec.replace(utils_js_1.default.streamRegexp, '[$1]'));
80
+ return this;
81
+ };
82
+ proto.updateFlvMetadata = proto.flvmeta = function () {
83
+ this._currentOutput.flags.flvmeta = true;
84
+ return this;
85
+ };
86
+ }
87
+ module.exports = applyOutputOptions;
88
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../lib/options/output.ts"],"names":[],"mappings":";;;;AACA,2DAAgC;AAGhC,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,UAAU,IAAI,KAAK,C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C,CAAC;IAEF,KAAK,CAAC,YAAY;QAChB,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,QAAQ;gBACZ,UAAmC,QAAyB;oBAC1D,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;oBAC7C,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC;IAEN,KAAK,CAAC,QAAQ;QACZ,KAAK,CAAC,gBAAgB;YACtB,KAAK,CAAC,YAAY;gBAClB,KAAK,CAAC,MAAM;oBACV,UAAmC,MAAc;wBAC/C,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;wBAC3C,OAAO,IAAI,CAAC;oBACd,CAAC,CAAC;IAEN,KAAK,CAAC,GAAG,GAAG,UAAmC,IAAY;QACzD,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,OAAO,GAAG;QACxC,IAAI,CAAC,cAAe,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,iBAAS,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FfmpegCommandPrototype } from '../types.js';
2
+ declare function applyVideoOptions(proto: FfmpegCommandPrototype): void;
3
+ export = applyVideoOptions;
4
+ //# sourceMappingURL=video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../lib/options/video.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAiC,MAAM,aAAa,CAAC;AAEzF,iBAAS,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAoE9D;AAED,SAAS,iBAAiB,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const utils_js_1 = __importDefault(require("../utils.js"));
6
+ function applyVideoOptions(proto) {
7
+ proto.withNoVideo = proto.noVideo = function () {
8
+ this._currentOutput.video.clear();
9
+ this._currentOutput.videoFilters.clear();
10
+ this._currentOutput.video('-vn');
11
+ return this;
12
+ };
13
+ proto.withVideoCodec = proto.videoCodec = function (codec) {
14
+ this._currentOutput.video('-vcodec', codec);
15
+ return this;
16
+ };
17
+ proto.withVideoBitrate = proto.videoBitrate = function (bitrate, constant) {
18
+ const rate = String(bitrate).replace(/k?$/, 'k');
19
+ this._currentOutput.video('-b:v', rate);
20
+ if (constant) {
21
+ this._currentOutput.video('-maxrate', rate, '-minrate', rate, '-bufsize', '3M');
22
+ }
23
+ return this;
24
+ };
25
+ proto.withVideoFilter =
26
+ proto.withVideoFilters =
27
+ proto.videoFilter =
28
+ proto.videoFilters =
29
+ function (...rest) {
30
+ const flat = rest.length > 1
31
+ ? rest
32
+ : Array.isArray(rest[0])
33
+ ? rest[0]
34
+ : [rest[0]];
35
+ this._currentOutput.videoFilters(utils_js_1.default.makeFilterStrings(flat));
36
+ return this;
37
+ };
38
+ proto.withOutputFps =
39
+ proto.withOutputFPS =
40
+ proto.withFpsOutput =
41
+ proto.withFPSOutput =
42
+ proto.withFps =
43
+ proto.withFPS =
44
+ proto.outputFPS =
45
+ proto.outputFps =
46
+ proto.fpsOutput =
47
+ proto.FPSOutput =
48
+ proto.fps =
49
+ proto.FPS =
50
+ function (fps) {
51
+ this._currentOutput.video('-r', fps);
52
+ return this;
53
+ };
54
+ proto.takeFrames =
55
+ proto.withFrames =
56
+ proto.frames =
57
+ function (frames) {
58
+ this._currentOutput.video('-vframes', frames);
59
+ return this;
60
+ };
61
+ }
62
+ module.exports = applyVideoOptions;
63
+ //# sourceMappingURL=video.js.map