npm.io
0.0.2 • Published 4 years ago

ffmpegvideocapture

Licence
ISC
Version
0.0.2
Deps
0
Size
4.6 MB
Vulns
0
Weekly
0

ffmpegVideoCapture

ffmpeg 的 wasm 版本,一个为 umd 格式的 npm 包,用于快速测试前端截帧

按照

npm i ffmpegvideocapture

使用

import ffmpegVideoCapture from 'ffmpegvideocapture'

const getVideoFrameByFfmpeg = async (file) => {
  return await new Promise((resolve) => {
    ffmpegVideoCapture.capture(file, 1000, async (dataURL, imageInfo) => {
      //dataURL 封面,格式为 base64
      //imageInfo 图片信息
      console.log('----imageInfo', dataURL, imageInfo)
      resolve({dataURL, imageInfo})
    })
  })
}