fluent-ffmpeg / node-fluent-ffmpeg

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

FfmpegCommand is not a constructor #1193

Closed Matix-Media closed 1 year ago

Matix-Media commented 1 year ago

Version information

Code to reproduce

const command = new FfmpegCommand(filePath);

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

Expected results

no error creating the command

Observed results

Error that FfmpegCommand is not a constructor.

TypeError: fluent_ffmpeg_1.FfmpegCommand is not a constructor
    at D:\Development\JS\media-server\src\entities\preview.ts:53:29

Checklist

Matix-Media commented 1 year ago

Turns out this a type definitions issue. (@types/fluent-ffmpeg)

NorthGuard commented 1 year ago

I have the same problem. How did you get rid of it? :) Can you not use @types/fluent-ffmpeg?

hshqwq commented 1 year ago

I have same problem.

This is my solution:

Replace import Ffmpeg from 'fluent-ffmpeg'; with import Ffmpeg = require('fluent-ffmpeg');

(If you don't need type, just use const Ffmpeg = require('fluent-ffmpeg');)

Because it's not a ES module, so we need to import like a CommonJs module.

stoplion commented 9 months ago

Is there a way in 2023 to use import and not require? 🙄

flazouh commented 3 months ago

That's such a hacky solution, but it worked