open-index/open-npm huggingface dataset:
npm package: @strangeape/ffmpeg-audio-wasm
Description: Audio-only FFmpeg compiled to WebAssembly. No native binaries, no postinstall scripts, works everywhere Node runs.
Latest version: 0.1.1

# @strangeape/ffmpeg-audio-wasm

Audio-only FFmpeg compiled to WebAssembly. No native binaries, no postinstall scripts, works everywhere Node runs.

**1.4MB** WASM, single-threaded, no SharedArrayBuffer required.

## Supported codecs

| | Encode | Decode |
|---|--------|--------|
| AAC | yes | yes |
| MP3 | | yes |
| Vorbis | | yes |
| Opus | | yes |
| FLAC | | yes |
| PCM (various) | yes | yes |

## Usage

```ts
import { createFFmpegAudio } from '@strangeape/ffmpeg-audio-wasm';

const ffmpeg = await createFFmpegAudio();

// Write input file to virtual FS
ffmpeg.writeFile('/input.wav', wavBuffer);

// Run ffmpeg command
const code = await ffmpeg.exec(['-y', '-i', '/input.wav', '-c:a', 'aac', '-q:a', '0.4', '/output.m4a']);

// Read output
const result = ffmpeg.readFile('/output.m4a');
```

Each `createFFmpegAudio()` call creates a fresh WASM instance to avoid state issues between runs.

## Building the WASM from source

Requires Docker.

```bash
bash build/build.sh
```

Built from FFmpeg 4.4.5 with Emscripten 3.1.50.