Low-level FFmpeg bindings for Bare.
npm i bare-ffmpeg
Complete API documentation for all components is available in the /docs directory:
- IOContext - Input/output context for media files with streaming support
- Dictionary - Key-value pairs for FFmpeg options
- Codec - Access to FFmpeg codecs
- CodecContext - Encoding/decoding functionality
- CodecParameters - Codec parameter configuration
- Stream - Media stream information and operations
- InputFormat - Input format specification
- OutputFormat - Output format specification
- FormatContext - Base class for media file handling
- InputFormatContext - Reading media files
- OutputFormatContext - Writing media files
- Frame - Decoded audio/video data
- Packet - Encoded audio/video data
- SideData - Packet side data and metadata
- Image - Raw pixel data management
- Rational - Rational number (fraction) representation
- Scaler - Video scaling and pixel format conversion
- Resampler - Audio resampling and format conversion
- Filter - FFmpeg filter access
- FilterGraph - Filter chain management
- FilterContext - Filter instance representation
- FilterInOut - Filter input/output pads
- AudioFIFO - Audio sample buffering
- HWDeviceContext - Hardware device context for acceleration
- HWFramesContext - Hardware frame pool management
- HWFramesConstraints - Hardware capability information
- Constants - FFmpeg constants and utility functions
https://github.com/holepunchto/bare-make is used for compiling the native bindings in binding.cc. Start by installing the tool globally:
npm i -g bare-makeNext, generate the build system for compiling the bindings, optionally setting the --debug flag to enable debug symbols and assertions:
bare-make generate [--debug]This only has to be run once per repository checkout. When updating bare-make or your compiler toolchain it might also be necessary to regenerate the build system. To do so, run the command again with the --no-cache flag set to disregard the existing build system cache:
bare-make generate [--debug] --no-cacheWith a build system generated, the bindings can be compiled:
bare-make buildThis will compile the bindings and output the resulting shared library module to the build/ directory. To install it into the prebuilds/ directory where the Bare addon resolution algorithm expects to find it, do:
bare-make installTo make iteration faster during development, the shared library module can also be linked into the prebuilds/ directory rather than copied. To do so, set the --link flag:
bare-make install --linkPrior to publishing the module, make sure that no links exist within the prebuilds/ directory as these will not be included in the resulting package archive.
A few compile options can be configured to customize the addon. Compile options may be set by passing the --define option=value flag to the bare-make generate command when generating the build system.
Warning
The compile options are not covered by semantic versioning and are subject to change without warning.
| Option | Default | Description |
|---|---|---|
BARE_FFMPEG_ENABLE_GPL |
OFF |
Enable GPL-licensed features (e.g, x264) |
Apache-2.0