node ffmpeg video from images code example
Example: node js ffmpeg image to video
const frames = ['frame1.jpg', 'frame2.jpg', ...]
const conv = ffmpeg()
const input = conv.input({f: 'image2pipe', r: 30})
conv.output('out.mp4', {vcodec: 'libx264', pix_fmt: 'yuv420p'})
frames.map(filename => () =>
new Promise((fulfill, reject) =>
s3
.getObject({Bucket: '...', Key: filename})
.createReadStream()
.on('end', fulfill)
.on('error', reject)
.pipe(input, {end: false})
)
)
.reduce((prev, next) => prev.then(next), Promise.resolve())
.then(() => input.end())
conv.run()