1.1.2 • Published 2 years ago

ffmpeg-panda v1.1.2

Weekly downloads
-
License
Creative Commons ...
Repository
github
Last release
2 years ago

ffmpeg-panda

Node Bash OSX

A ffmpeg nodejs wrapper to access to ffmpeg withing your nodejs code

InstallationUsageLicense . 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 ⚠️

Installation

brew install ffmpeg
npm i ffmpeg-panda

Usage

import Ffmpeg from './ffmpeg.js'

Ffmpeg.listDevices()

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))

Device.infos()

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()

Device.listModes()

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()

Device.listPixelFormats()

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()

Device.takePicture()

Take a picture with the device

ArgumentTypeDescription
outputstringthe file output
resolutionstringthe resolution
pixel formatstringthe 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)

Device.takeVideo()

Take a video with the device

ArgumentTypeDescription
outputstringthe file output
durationnumberthe video duration in second
resolutionstringthe resolution
fpsstringthe framerate
pixel formatstringthe 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)

License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International

by-sa

Changelog

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

Roadmap

  • Make future change non breaking
  • Make sound record avaiable

Contributing

A bug ? An idea of feature ? Fill an issue on github

Support

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago