从视频中提取帧?

时间:2019-05-11 02:21:10

标签: node.js

我想从视频中提取帧并保存帧

var express = require("express"),

 var video = "./s/video.mp4";
 var storeOutput = "./store"
 function getVideoFrames(){
        // get frames
 }

1 个答案:

答案 0 :(得分:0)

通常,在处理视频时, ffmpeg 是一个很好的使用工具。 npm存储库上有一个基于{em> fluent-ffmpeg 的ffmpeg-extract-frames软件包,正是该软件包执行了该操作。

const extractFrames = require('ffmpeg-extract-frames')

extractFrames({
  input: 's/video.mp4',
  output: './store/frame-%d.jpg'
})

如果需要,您可以将以毫秒为单位的时间数组传递给offsets选项,以仅提取特定的帧。

extractFrames({
  input: 's/video.mp4',
  output: './store/screenshot-%i.jpg',
  offsets: [
    1000,
    2000,
    3000
  ]
})
相关问题