Estoy tratando de crear un archivo de video usando múltiples imágenes usando ffmpeg-stream.
Aquí está mi código,
const { Converter } = require("ffmpeg-stream") const frames = ["open.jpg", "close.jpg", "open.jpg", "close.jpg"] // create converter const converter = new Converter() // create input writable stream (the jpeg frames) const converterInput = converter.createInputStream({ f: "image2pipe", r: 30 }) // create output to file (mp4 video) converter.createOutputToFile("out.mp4", { vcodec: "libx264", pix_fmt: "yuv420p", }) // start the converter, save the promise for later const convertingFinished = converter.run() // pipe all the frames to the converter sequentially for (const filename of frames) { // create a promise for every frame and await it new Promise((resolve, reject) => { fs.createReadStream(filename) .pipe(converterInput, { end: false }) // pipe to converter, but don't end the input yet .on("end", resolve) // resolve the promise after the frame finishes .on("error", reject) }) } converterInput.end()Código en los documentos de ffmpeg-stream, https://github.com/phaux/node-ffmpeg-stream#how-to-create-an-animation-from-a-set-of-image-files
Están usando s3, solo lo cambié a mi archivo local en mi código. Todo lo demás es casi igual. Pero cuando lo ejecuto me sale el siguiente error,
node:internal/errors:464 ErrorCaptureStackTrace(err); ^ Error: spawn ffmpeg ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19) at onErrorNT (node:internal/child_process:477:16) at processTicksAndRejections (node:internal/process/task_queues:83:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn ffmpeg', path: 'ffmpeg', spawnargs: [ '-f', 'image2pipe', '-r', '30', '-i', 'pipe:3', '-vcodec', 'libx264', '-pix_fmt', 'yuv420p', 'out.mp4' ] }Qué estoy haciendo mal :(