fluent-ffmpeg / node-fluent-ffmpeg

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

spawn issue occurs on Windows 32 bit, but works with Win64 bit. #1158

Open sherali-uz opened 2 years ago

sherali-uz commented 2 years ago
Error: spawn UNKNOWN
    at ChildProcess.spawn (internal/child_process.js:407:11)
    at spawn (child_process.js:557:9)
    at C:\Program Files\Pivo Present\resources\app.asar\node_modules\fluent-ffmpeg\lib\processor.js:152:24
    at FfmpegCommand.proto._getFfmpegPath (C:\Program Files\Pivo Present\resources\app.asar\node_modules\fluent-ffmpeg\lib\capabilities.js:90:14)
    at FfmpegCommand.proto._spawnFfmpeg (C:\Program Files\Pivo Present\resources\app.asar\node_modules\fluent-ffmpeg\lib\processor.js:132:10)
    at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (C:\Program Files\Pivo Present\resources\app.asar\node_modules\fluent-ffmpeg\lib\capabilities.js:517:10)
    at C:\Program Files\Pivo Present\resources\app.asar\node_modules\fluent-ffmpeg\lib\capabilities.js:568:14
    at nextTask (C:\Program Files\Pivo Present\resources\app.asar\node_modules\async\dist\async.js:4576:27)
    at Object.waterfall (C:\Program Files\Pivo Present\resources\app.asar\node_modules\async\dist\async.js:4587:9)
    at Object.awaitable [as waterfall] (C:\Program Files\Pivo Present\resources\app.asar\node_modules\async\dist\async.js:208:32) {
  errno: 'UNKNOWN',
  code: 'UNKNOWN',
  syscall: 'spawn'
}

My code is here:

import ffmpeg from "fluent-ffmpeg";
const ffmpegPath = require("ffmpeg-static").replace(
  "app.asar",
  "app.asar.unpacked"
);
const ffprobePath = require("ffprobe-static").path.replace(
  "app.asar",
  "app.asar.unpacked"
);

ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg.setFfprobePath(ffprobePath);

function startTranscode(input, output) {
    //error throws when this function called in win 32
      ffmpeg(inputPath)
        .format(format)
        .on("start", () => {
          console.log("conversion:start", inputPath, outputPath);
        })
        .on("progress", (data) => {
          console.log("conversion:progress", data, data.percent / 100);
        })
        .on("end", (e) => {
          console.log("conversion:end", inputPath, outputPath, e);
        })
        .on("error", (e) => {
          console.error("conversion:error", e);
        })
        .save(outputPath);
 }

in electron build configuration:

externals: ["fluent-ffmpeg", "ffmpeg-static", "ffprobe-static", ],
chainWebpackMainProcess: (config) => {
        config.plugin("define").tap((args) => {
          args[0]["process.env.FLUENTFFMPEG_COV"] = false;
          return args;
        });
      },

Any idea?

petem24 commented 1 year ago

Did you fix this?