fluent-ffmpeg / node-fluent-ffmpeg

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

Uncaught NodeError TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. #1174

Open xuguanqun opened 2 years ago

xuguanqun commented 2 years ago
const ffmpegStatic = require("ffmpeg-static");
const ffprobeStatic = require("ffprobe-static");
const fluentffmpeg = require("fluent-ffmpeg");

const ffmpeg = new fluentffmpeg();

ffmpeg.setFfmpegPath(ffmpegStatic);
ffmpeg.setFfprobePath(ffprobeStatic);
// ffmpeg.setFlvtoolPath();

const iptpath = "D:\\1.mkv";
const optpath = "D:\\2.mp4";

ffmpeg.addInput(iptpath);
ffmpeg.output(optpath);

ffmpeg.ffprobe((err, metadata) => {
  console.log(err, metadata);
});

error:

Uncaught NodeError TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received an instance of Object
    at NodeError (internal/errors.js:279:9)
    at validateString (internal/validators.js:124:11)
    at normalizeSpawnArguments (child_process.js:509:3)
    at spawn (child_process.js:665:13)
    at spawnWithSignal (child_process.js:871:17)
    at <anonymous> ([c:\Users\Administrator\Desktop\fluent-ffmpeg\node_modules\fluent-ffmpeg\lib\ffprobe.js:155:21]())
    at proto._getFfprobePath ([c:\Users\Administrator\Desktop\fluent-ffmpeg\node_modules\fluent-ffmpeg\lib\capabilities.js:144:14]())
    at proto.ffprobe ([c:\Users\Administrator\Desktop\fluent-ffmpeg\node_modules\fluent-ffmpeg\lib\ffprobe.js:141:10]())
    at <anonymous> ([c:\Users\Administrator\Desktop\fluent-ffmpeg\index.js:17:8]())
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Module._load (internal/modules/cjs/loader.js:778:12)
    at executeUserEntryPoint (internal/modules/run_main.js:76:12)
    at <anonymous> (internal/main/run_main_module.js:17:47)
ReniDelonzek commented 1 year ago

Any update?

rvenky125 commented 1 year ago

any update?

takahashi-shotaro-al commented 10 months ago

require('ffmpeg-static') returns string but require('ffprobe-static') returns { path: string }

> require('ffmpeg-static')
'I:\\works\\workspace\\***\\node_modules\\ffmpeg-static\\ffmpeg.exe'
>
> require('ffprobe-static')
{
  path: 'I:\\works\\workspace\\***\\node_modules\\ffprobe-static\\bin\\win32\\x64\\ffprobe.exe'
}