node js ffmpeg image to video
const frames = ['frame1.jpg', 'frame2.jpg', ...]
const conv = ffmpeg() // create converter
const input = conv.input({f: 'image2pipe', r: 30}) // create input writable stream
conv.output('out.mp4', {vcodec: 'libx264', pix_fmt: 'yuv420p'}) // output to file
// for every frame create a function that returns a promise
frames.map(filename => () =>
new Promise((fulfill, reject) =>
s3
.getObject({Bucket: '...', Key: filename})
.createReadStream()
.on('end', fulfill) // fulfill promise on frame end
.on('error', reject) // reject promise on error
.pipe(input, {end: false}) // pipe to converter, but don't end the input yet
)
)
// reduce into a single promise, run sequentially
.reduce((prev, next) => prev.then(next), Promise.resolve())
// end converter input
.then(() => input.end())
conv.run()
Also in JavaScript:
- compare two arrays javascript
- filtering array of friends javascript
- how to align placeholder in react native
- mathematically create bezier curve javascript
- remove commas and dollar sign from string js
- angular wait all subscriptions
- vuejs components props pass array
- base64 encode node js
- how to create alias in populate moongoose + nodejs
- javascript clear localstorage
- import input text material ui
- JavaScript Populating a Hash
- react padding at bottom svg
- how to set input of time type to current time on initialization
- remove array empty values javascript
- jquery val style
- post method javascript code
- find if json property is of type date type
- react native preload local images
- react native status bar
- javascript is valid email
- get radio button value javascript
- enable version 12 node glitch
- console trace js