UNPKG

@calipsa/video-utils

Version:
37 lines (26 loc) 666 B
import { Writable } from 'stream' import { Converter } from 'ffmpeg-stream' import type { PathOrReadable } from '../types' import getFfmpegOptions from './getFfmpegOptions' import streamImages from './streamImages' type Format = 'wmv' | 'mp4' interface Params { images: PathOrReadable[], format: Format, fps: number, } export default ({ images, format, fps, }: Params) => { const converter = new Converter() const input = converter.createInputStream({ f: 'image2pipe', r: fps, }) as Writable const output = converter.createOutputStream(getFfmpegOptions(format)) streamImages(images, input) converter.run() return output }