fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.62k stars 872 forks source link

Error: Input format lavfi is not available #1282

Open fa0311 opened 1 week ago

fa0311 commented 1 week ago

Version information

Code to reproduce

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