Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
Creating video from images using ffmpeg-stream

I'm trying to create a video file using multiple images using ffmpeg-stream.

Here's my code,

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()

Code in the ffmpeg-stream docs, https://github.com/phaux/node-ffmpeg-stream#how-to-create-an-animation-from-a-set-of-image-files

They are using s3, I just changed it to my local file in my code. Everything else is almost same. But when I run it I get the following 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'
  ]
}

What am I doing wrong :(

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda