Skip to content

quentinlamamy/ffmpeg-panda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

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

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)

Device.takeVideo()

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)

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

Buy Me A Coffee

About

ffmpeg nodejs wrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published