Error: Input format lavfi is not available

Author: fa0311Created Jun 25, 2024Updated Feb 7, 2025

Version information

  • fluent-ffmpeg version: 2.1.3
  • ffmpeg version: 7.0.1
  • OS: Windows

Code to reproduce

javascript
import { default as ffmpeg, default as ffprobe } from "fluent-ffmpeg";
const command = ffmpeg();
command.input("anullsrc=channel_layout=mono:sample_rate=44100");
command.inputFormat("lavfi");
command.addOption("-t", "20");
command.output("test.mp4")
command.run();

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

Observed results

Error: Input format lavfi is not available

Temporary workaround

typescript
// TypeScript
const bypass = (command: ffmpeg.FfmpegCommand) => {
    const bk = command.availableFormats;
    command.availableFormats = (cb: (err: any, data: any) => void) => {
      bk.bind(command)((err, data) => {
        const lavfi = {
          canDemux: true,
          canMux: true,
          description: "Lavfi",
        };
        cb(err, { ...data, lavfi });
      });
    };
  }

Checklist

  • I have read the FAQ
  • I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place)
  • I have included full stderr/stdout output from ffmpeg

Source: fluent-ffmpeg/node-fluent-ffmpeg