Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

videoshow.images.map is not a function #110

Open
dusklight00 opened this issue Jun 17, 2022 · 0 comments
Open

videoshow.images.map is not a function #110

dusklight00 opened this issue Jun 17, 2022 · 0 comments

Comments

@dusklight00
Copy link

dusklight00 commented Jun 17, 2022

I ran the example code on node v16.13.1

var videoshow = require("videoshow");

var images = getFrames("./anim");

var videoOptions = {
  fps: 25,
  loop: 5, // seconds
  transition: true,
  transitionDuration: 1, // seconds
  videoBitrate: 1024,
  videoCodec: "libx264",
  size: "640x?",
  audioBitrate: "128k",
  audioChannels: 2,
  format: "mp4",
  pixelFormat: "yuv420p",
};

function getFrames(dir) {
  return new Promise((resolve, reject) => {
    fs.readdir(dir, (err, files) => {
      if (err) throw err;
      files = files.sort((a, b) => parseInt(a) - parseInt(b));
      files = files.map((file) => dir + "/" + file);
      resolve(files);
    });
  });
}

videoshow(images, videoOptions)
  .save("video.mp4")
  .on("start", function (command) {
    console.log("ffmpeg process started:", command);
  })
  .on("error", function (err, stdout, stderr) {
    console.error("Error:", err);
    console.error("ffmpeg stderr:", stderr);
  })
  .on("end", function (output) {
    console.error("Video created in:", output);
  });

I'm getting this error

return videoshow.images.map(function (image) {
                          ^

TypeError: videoshow.images.map is not a function
    at convertImages (F:\Paradise\Projects\Personal Projects\active\automated-osu-videos-generator\node_modules\videoshow\lib\render.js:41:27)
    at processVideo (F:\Paradise\Projects\Personal Projects\active\automated-osu-videos-generator\node_modules\videoshow\lib\render.js:32:19)
    at F:\Paradise\Projects\Personal Projects\active\automated-osu-videos-generator\node_modules\videoshow\lib\render.js:25:5
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant