mulmocast 2.22.0 → 2.22.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.
@@ -12,6 +12,7 @@ import { agentIncorrectAPIKeyError, agentAPIRateLimitError, imageAction, imageFi
12
12
  import { getOutputStudioFilePath, mkdir } from "../utils/file.js";
13
13
  import { audioCheckerError } from "../utils/error_cause.js";
14
14
  import { extractImageFromMovie, ffmpegGetMediaDuration, trimMusic } from "../utils/ffmpeg_utils.js";
15
+ import { audioProbeSource } from "../utils/audio_probe_source.js";
15
16
  import { getMediaRefs, resolveBeatLocalRefs } from "./image_references.js";
16
17
  import { imagePreprocessAgent, imagePluginAgent, htmlImageGeneratorAgent, beatFrameResolverAgent } from "./image_agents.js";
17
18
  import { imageGraphOption } from "./graph_option.js";
@@ -232,7 +233,7 @@ export const beat_graph_data = {
232
233
  if (namedInputs.soundEffectFile) {
233
234
  return { hasMovieAudio: true };
234
235
  }
235
- const sourceFile = namedInputs.movieFile || namedInputs.imageFile;
236
+ const sourceFile = audioProbeSource(namedInputs);
236
237
  if (!sourceFile) {
237
238
  // no need to check if the file exists (ffmpegGetMediaDuration will check it if it is local file)
238
239
  return { hasMovieAudio: false };
@@ -0,0 +1,5 @@
1
+ export declare const isStillImageFile: (filePath: string) => boolean;
2
+ export declare const audioProbeSource: (files: {
3
+ movieFile?: string;
4
+ imageFile?: string;
5
+ }) => string | undefined;
@@ -0,0 +1,16 @@
1
+ import path from "node:path";
2
+ // A still image never carries an audio track, so probing it only makes ffprobe a requirement for image-only renders.
3
+ const STILL_IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"]);
4
+ export const isStillImageFile = (filePath) => {
5
+ const withoutQuery = filePath.split(/[?#]/)[0];
6
+ return STILL_IMAGE_EXTENSIONS.has(path.extname(withoutQuery).toLowerCase());
7
+ };
8
+ export const audioProbeSource = (files) => {
9
+ if (files.movieFile) {
10
+ return files.movieFile;
11
+ }
12
+ if (!files.imageFile || isStillImageFile(files.imageFile)) {
13
+ return undefined;
14
+ }
15
+ return files.imageFile;
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "2.22.0",
3
+ "version": "2.22.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",