Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring stderr/stdout #11

Closed
LucCADORET opened this issue Dec 5, 2019 · 4 comments
Closed

Allow configuring stderr/stdout #11

LucCADORET opened this issue Dec 5, 2019 · 4 comments

Comments

@LucCADORET
Copy link

Currently, the module prints data to stdout/stderr, which is undefined when using the library in a web worker. Catching the data can be really useful when you want to get information on the files (what are the codecs, the size of the file, that sort of things).

What would be nice, is to be able to override the "print" and "printErr" callbacks of the module, to catch the output data of ffmpeg. https://emscripten.org/docs/api_reference/module.html

@jeromewu
Copy link
Collaborator

jeromewu commented Dec 5, 2019

May I know the version you are using? This feature has been added in the last few versions of ffmpeg.js.
You can get print and printErr output by assigning logger in createWorker.

Snippet:

const worker = createWorker({
  logger: log => console.log(log),
});

@LucCADORET
Copy link
Author

I am actually not using a pure version of @ffmpeg/ffmpeg, I am using a custom worker, along with @ffmpeg/core. I have tried to configure the "Module" directly (overriding Module.print and Module.printErr) without any result. Thanks for the fast reply, I will look into the new version to see how you have done it, and reproduce.

@jeromewu
Copy link
Collaborator

jeromewu commented Dec 5, 2019

Here is the key file for your reference.

https://github.com/ffmpegjs/FFmpeg/blob/n4.1.4-js/javascript/prepend.js

@jeromewu
Copy link
Collaborator

jeromewu commented Dec 8, 2019

Close for now.

@jeromewu jeromewu closed this as completed Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants