A ffmpeg nodejs wrapper to access to ffmpeg withing your nodejs code
Installation • Usage • License . Changelog . Changelog . Contributing . Support
⚠️ This project is still in beta, it works only on OSX, windows and linux version comming soon. Due to beta status, breaking change will appear, check the changelog and the documentation. A stable version will be release in next weeks for the 1.5⚠️
brew install ffmpeg
npm i ffmpeg-panda
import Ffmpeg from './ffmpeg.js'
List avaiable devices
ℹ️ Because of some usage issue , screen device are hidden. They will be available in future version
// Get device list
let deviceList = await Ffmpeg.listDevices()
// Print device list
console.log(deviceList.map(d => "[" + d.index + "] " + d.name))
Show device informations and features
// Get device list
let deviceList = await Ffmpeg.listDevices()
let device = deviceList[0]
// Retrieve devices features
await device.detectFeatures()
// Print devices features
device.infos()
Show devices modes, mods are sorted by width
// Get device list
let deviceList = await Ffmpeg.listDevices()
let device = deviceList[0]
// Retrieve devices features
await device.detectFeatures()
// Print devices modes
device.listModes()
Show pixel format
// Get device list
let deviceList = await Ffmpeg.listDevices()
let device = deviceList[0]
// Retrieve devices features
await device.detectFeatures()
// Print devices pixel format
device.listPixelFormats()
Take a picture with the device
Argument | Type | Description |
---|---|---|
output | string | the file output |
resolution | string | the resolution |
pixel format | string | the pixel format |
By default if no argument given, it will use the last mode of the list (the one width max width) and the first pixel format of the list. The output filename will be : output.jpg
❌ Will return a rejected promise if given parameters doesn't fit an avaiable mode
// Get device list
let deviceList = await Ffmpeg.listDevices()
let device = deviceList[0]
// Retrieve devices features
await device.detectFeatures()
let filename = await device.takePicture()
console.log("File created: " + filename)
Take a video with the device
Argument | Type | Description |
---|---|---|
output | string | the file output |
duration | number | the video duration in second |
resolution | string | the resolution |
fps | string | the framerate |
pixel format | string | the pixel format |
By default if no argument given, it will use the last mode of the list (the one width max width) and the first pixel format of the list. The output filename will be : output.avi
❌ Will return a rejected promise if given parameters doesn't fit an avaiable mode
let deviceList = await Ffmpeg.listDevices()
let device = deviceList[0]
await device.detectFeatures()
let filename = await device.takeVideo("test.avi",10)
console.log("File created: " + filename)
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International
1.1.0 :
- 💥Breaking change💥 parameter order for taking picture of video change, output file become the first one (see documentation)
- 💥Breaking change💥 remove fps param for for taking picture
- Adding takeVideo method
- Adding more comment
- Make future change non breaking
- Make sound record avaiable
A bug ? An idea of feature ? Fill an issue on github