@leelaing/media-tools
v0.1.0
Published
Reusable FFmpeg, FFprobe, audio, video, probing, conversion, and media-processing utilities.
Maintainers
Readme
@leelaing/media-tools
Reusable FFmpeg, FFprobe, audio, video, probing, conversion, and media-processing utilities.
Features
- Discover FFmpeg and FFprobe executables
- Probe media metadata and streams
- Parse duration, codecs, sample rate, channels, dimensions, frame rate, and bitrate
- Build consistent FFmpeg command specs
- Normalize/extract audio to 44.1 kHz stereo PCM16 WAV by default
- Build configurable audio/video transcodes
- Extract video frames/thumbnails
- Run commands with timeout and abort support
Install
npm install @leelaing/media-toolsFFmpeg and FFprobe must be installed on the host system or supplied by path.
Example
import {
buildNormalizeAudioCommand,
probeMedia,
runFfmpeg,
} from '@leelaing/media-tools';
const media = await probeMedia('/path/to/song.mp3');
console.log(media.duration, media.audioStreams[0]?.sampleRate);
await runFfmpeg(
buildNormalizeAudioCommand('/path/to/input.webm', '/path/to/output.wav'),
);Development
npm install
npm startQuality checks
npm run checkLicense
MIT
