mulmocast 1.2.37 → 1.2.38
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/lib/actions/images.js +8 -2
- package/lib/utils/ffmpeg_utils.js +12 -5
- package/package.json +1 -1
package/lib/actions/images.js
CHANGED
|
@@ -195,8 +195,14 @@ export const beat_graph_data = {
|
|
|
195
195
|
// no need to check if the file exists (ffmpegGetMediaDuration will check it if it is local file)
|
|
196
196
|
return { hasMovieAudio: false };
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
try {
|
|
199
|
+
const { hasAudio } = await ffmpegGetMediaDuration(sourceFile);
|
|
200
|
+
return { hasMovieAudio: hasAudio };
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
GraphAILogger.error(error);
|
|
204
|
+
throw Error("audioChecker: ffmpegGetMediaDuration error.");
|
|
205
|
+
}
|
|
200
206
|
},
|
|
201
207
|
inputs: {
|
|
202
208
|
onComplete: [":movieGenerator", ":htmlImageGenerator", ":soundEffectGenerator"],
|
|
@@ -63,11 +63,18 @@ export const FfmpegContextGenerateOutput = (context, output, options = []) => {
|
|
|
63
63
|
export const ffmpegGetMediaDuration = (filePath) => {
|
|
64
64
|
return new Promise((resolve, reject) => {
|
|
65
65
|
// Only check file existence for local paths, not URLs
|
|
66
|
-
if (!filePath.startsWith("http://") && !filePath.startsWith("https://")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
if (!filePath.startsWith("http://") && !filePath.startsWith("https://")) {
|
|
67
|
+
if (!fs.existsSync(filePath)) {
|
|
68
|
+
// NOTE: We don't reject here for scripts/test/test_hello_image.json, which uses mock image agent.
|
|
69
|
+
// reject(new Error(`File not found: ${filePath}`));
|
|
70
|
+
resolve({ duration: 0, hasAudio: false });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const stat = fs.statSync(filePath);
|
|
74
|
+
if (!stat.isFile()) {
|
|
75
|
+
reject("ffmpegGetMediaDuration: path is not file");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
71
78
|
}
|
|
72
79
|
ffmpeg.ffprobe(filePath, (err, metadata) => {
|
|
73
80
|
if (err) {
|