ffmpeg.js icon indicating copy to clipboard operation
ffmpeg.js copied to clipboard

Cannot read property 'write' of undefined

Open woniesong92 opened this issue 4 years ago • 8 comments

I ran into this exception and couldn't find any related issue in the repo. Maybe I'm passing the video in the wrong way to ffmpeg?

Repro steps

  1. Load a video to a blob
const blob = await fetch(videoURL).then((r) => r.blob());
  1. Try to do a simple trim operation using ffmpeg.js
const result = ffmpeg({
  MEMFS: [{ name: "video.webm", data: blob }],
  arguments: [
    "-ss",
    "00:00:1.0",
    "-i",
    "video.webm",
    "-t",
    "10",
    "-c",
    "copy",
    "output.webm",
  ],
});
console.log(result);
  1. Verify the exception is thrown

Stack trace

When I look at the stack to see where the exception is thrown, I think this line is the culprit:

process.stdout.write.bind(process.stdout)

Since this is on the client side, there's no process.stdout. Is there a way for me to prevent this from happening?

Environment

  • Next.js
  • ffmpeg.js: ^4.2.9003
  • Chrome

woniesong92 avatar Oct 03 '20 20:10 woniesong92

I have noticed this as well. It seems when you do your own build with the steps on the readme, the build is different then the standard prebuilt js files that you get from "npm install ffmpeg.js." As you can see highlighted in the picture there are multiple lines like "process.stdout.write" and "process.stderr." The normal npm download does not included these lines of code.

Not sure what's causing this but if I find out anything I will update this thread.

Screen Shot 2020-10-08 at 3 17 50 PM

Galante97 avatar Oct 08 '20 19:10 Galante97

Any news about this issue? I'm having the same problem.

rodrigopecci avatar Nov 06 '20 14:11 rodrigopecci

I have noticed this as well. It seems when you do your own build with the steps on the readme, the build is different then the standard prebuilt js files that you get from "npm install ffmpeg.js." As you can see highlighted in the picture there are multiple lines like "process.stdout.write" and "process.stderr." The normal npm download does not included these lines of code.

Not sure what's causing this but if I find out anything I will update this thread.

Screen Shot 2020-10-08 at 3 17 50 PM

I installed using npm and i have the same issue.

rodrigopecci avatar Nov 06 '20 14:11 rodrigopecci

I can reproduce this issue on mac OSX, ffmpeg installed from brew, ffmpeg js installed via npm.

siddharthsrivastava avatar May 07 '21 21:05 siddharthsrivastava

Even when installing via NPM I can also reproduce the issue, when running in a browser environment.

yahsaves avatar Jul 02 '21 16:07 yahsaves

I have the same issue using the NPM package in a browser environment. Any updates on this?

siebediels avatar May 03 '22 09:05 siebediels

I have the same problem

joehinkle11 avatar Oct 24 '22 16:10 joehinkle11

Is this issue still open? Cause I encounter the same issue with MacOS, installed via NPM

realboa avatar Nov 19 '22 01:11 realboa