mulmocast 2.4.0 → 2.4.1
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.
|
@@ -41,6 +41,7 @@ type ImageHtmlPreprocessAgentResponse = {
|
|
|
41
41
|
};
|
|
42
42
|
type ImageOnlyMoviePreprocessAgentResponse = ImagePreprocessAgentResponseBase & {
|
|
43
43
|
imageFromMovie: boolean;
|
|
44
|
+
useLastFrame?: boolean;
|
|
44
45
|
};
|
|
45
46
|
type ImagePluginPreprocessAgentResponse = ImagePreprocessAgentResponseBase & {
|
|
46
47
|
referenceImageForMovie: string;
|
|
@@ -85,6 +85,7 @@ export const imagePreprocessAgent = async (namedInputs) => {
|
|
|
85
85
|
imagePath, // for thumbnail extraction
|
|
86
86
|
movieFile: animatedVideoPath, // .mp4 path for the pipeline
|
|
87
87
|
imageFromMovie: true, // triggers extractImageFromMovie
|
|
88
|
+
useLastFrame: true, // extract last frame for PDF/static (animation complete state)
|
|
88
89
|
referenceImageForMovie: pluginPath,
|
|
89
90
|
markdown,
|
|
90
91
|
html,
|
package/lib/actions/images.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ export declare const beat_graph_data: {
|
|
|
118
118
|
imagePath?: string;
|
|
119
119
|
} & {
|
|
120
120
|
imageFromMovie: boolean;
|
|
121
|
+
useLastFrame?: boolean;
|
|
121
122
|
}) | ({
|
|
122
123
|
imageParams?: MulmoImageParams;
|
|
123
124
|
movieFile?: string;
|
|
@@ -286,11 +287,13 @@ export declare const beat_graph_data: {
|
|
|
286
287
|
agent: (namedInputs: {
|
|
287
288
|
movieFile: string;
|
|
288
289
|
imageFile: string;
|
|
290
|
+
useLastFrame: boolean;
|
|
289
291
|
}) => Promise<object>;
|
|
290
292
|
inputs: {
|
|
291
293
|
onComplete: string[];
|
|
292
294
|
imageFile: string;
|
|
293
295
|
movieFile: string;
|
|
296
|
+
useLastFrame: string;
|
|
294
297
|
};
|
|
295
298
|
defaultValue: {};
|
|
296
299
|
};
|
package/lib/actions/images.js
CHANGED
|
@@ -187,12 +187,13 @@ export const beat_graph_data = {
|
|
|
187
187
|
imageFromMovie: {
|
|
188
188
|
if: ":preprocessor.imageFromMovie",
|
|
189
189
|
agent: async (namedInputs) => {
|
|
190
|
-
return await extractImageFromMovie(namedInputs.movieFile, namedInputs.imageFile);
|
|
190
|
+
return await extractImageFromMovie(namedInputs.movieFile, namedInputs.imageFile, namedInputs.useLastFrame);
|
|
191
191
|
},
|
|
192
192
|
inputs: {
|
|
193
193
|
onComplete: [":movieGenerator", ":imagePlugin"], // :imagePlugin for animated html_tailwind video generation
|
|
194
194
|
imageFile: ":preprocessor.imagePath",
|
|
195
195
|
movieFile: ":preprocessor.movieFile",
|
|
196
|
+
useLastFrame: ":preprocessor.useLastFrame",
|
|
196
197
|
},
|
|
197
198
|
defaultValue: {},
|
|
198
199
|
},
|
|
@@ -25,7 +25,7 @@ export declare const ffmpegGetMediaDuration: (filePath: string) => Promise<{
|
|
|
25
25
|
duration: number;
|
|
26
26
|
hasAudio: boolean;
|
|
27
27
|
}>;
|
|
28
|
-
export declare const extractImageFromMovie: (movieFile: string, imagePath: string) => Promise<object>;
|
|
28
|
+
export declare const extractImageFromMovie: (movieFile: string, imagePath: string, useLastFrame?: boolean) => Promise<object>;
|
|
29
29
|
export declare const trimMusic: (inputFile: string, startTime: number, duration: number) => Promise<Buffer>;
|
|
30
30
|
export declare const createSilentAudio: (filePath: string, durationSec: number) => Promise<void>;
|
|
31
31
|
export declare const pcmToMp3: (rawPcm: Buffer, sampleRate?: number) => Promise<Buffer>;
|
|
@@ -117,9 +117,13 @@ export const ffmpegGetMediaDuration = (filePath) => {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
};
|
|
120
|
-
export const extractImageFromMovie = (movieFile, imagePath) => {
|
|
120
|
+
export const extractImageFromMovie = (movieFile, imagePath, useLastFrame = false) => {
|
|
121
121
|
return new Promise((resolve, reject) => {
|
|
122
|
-
ffmpeg(movieFile)
|
|
122
|
+
const command = ffmpeg(movieFile);
|
|
123
|
+
if (useLastFrame) {
|
|
124
|
+
command.inputOptions(["-sseof", "-0.1"]);
|
|
125
|
+
}
|
|
126
|
+
command
|
|
123
127
|
.outputOptions(["-frames:v 1"])
|
|
124
128
|
.output(imagePath)
|
|
125
129
|
.on("end", () => resolve({}))
|