Extracts a single frame from a video using fluent-ffmpeg.
npm install --save ffmpeg-extract-frame
# or
yarn add ffmpeg-extract-frame
const extractFrame = require('ffmpeg-extract-frame')
await extractFrame({
input: 'media/1.mp4',
output: 'test.jpg',
offset: 1000 // seek offset in milliseconds
})
Extracts a single frame from a video file. Returns a Promise
for when the file has been written.
Type: String
Path or URL to a video file.
Type: String
Path to a jpg
or png
file to output.
Type: Number
Default: 0
Seek offset to take the screenshot from in milliseconds.
Type: Number
Default: 2
If exporting a jpeg image, the quality from 1-31 with 31 being the worst quality (source).
Type: Function
Default: noop
Optional function to log the underlying ffmpeg command. You may, for example, use console.log
- ffmpeg-extract-frames extracts multiple frames at a time.
- fluent-ffmpeg
- awesome-ffmpeg - A curated list of awesome ffmpeg resources with a focus on JavaScript.
MIT © Travis Fischer
Support my OSS work by following me on twitter