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

Nodejs support #4

Open
loretoparisi opened this issue Dec 15, 2020 · 8 comments
Open

Nodejs support #4

loretoparisi opened this issue Dec 15, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@loretoparisi
Copy link

loretoparisi commented Dec 15, 2020

Support to load the wasm compiled ffprobe module into nodejs.

Also I can see from the Dockerfile that the whole source ffmpeg is compiled. So is possible to wrap ffmpeg as well?

Thank you.

@alfg
Copy link
Owner

alfg commented Dec 15, 2020

Hi @loretoparisi,

I don't compile the full feature set of ffmpeg to keep the filesize minimal (~2MB). However, I plan to find an optimal build size that contains most common demuxer and decoder support. I won't be adding NodeJS support since this is intended for browser use.

@alfg alfg closed this as completed Dec 15, 2020
@loretoparisi
Copy link
Author

@alfg do you think it would be possible to use current ffprobe wasm artifacts to be used in nodejs without modifications?
I did something like that in the past but I remember there were specific emscripten compilation flags to be used.

Thank you.

@alfg
Copy link
Owner

alfg commented Dec 15, 2020

Hi @loretoparisi, I have not tried running the ffprobe wasm artificat in nodejs without modification. So I'm not sure if it will work or not. Have you checked out https://github.com/ffmpegwasm/ffmpeg.wasm ?

@loretoparisi
Copy link
Author

Hi @loretoparisi, I have not tried running the ffprobe wasm artificat in nodejs without modification. So I'm not sure if it will work or not. Have you checked out https://github.com/ffmpegwasm/ffmpeg.wasm ?

@alfg thank you, yes I actually landed to you project from this issue

ffmpegwasm/ffmpeg.wasm#121

Hopefully, there is a way to take the best of the two worlds!

@alfg
Copy link
Owner

alfg commented Dec 22, 2020

@loretoparisi Oh, ha! Looks like you already checked there. :)

I'm not actually building or using FFProbe in this project. Instead I am using FFmpeg's libavformat and libavcodec to output similar results. So I'm not sure if NodeJS support would have the same interface you are looking for in that linked issue above.

However, I may be able to build a separate module for use with NodeJS. I'll re-open this issue as a TODO.

@alfg alfg reopened this Dec 22, 2020
@alfg alfg added the enhancement New feature or request label Dec 22, 2020
@loretoparisi
Copy link
Author

@alfg thank you! Any progress? I have tried the latest version, I was wondering if mp3 input format may be supported in next versions, thank you.

ERROR: Invalid data found when processing input

@jhurliman
Copy link

I believe this ticket can be closed, node.js support is working in my testing. I created a separate issue for MP3 support (which I am also blocked on): #19

@loretoparisi
Copy link
Author

@jhurliman I was able to build and run the docker container and the application, but I'm struggling to import the generated module ffprobe-wasm.js to nodejs (commonjs import types)

the dist outcome in the docker container was

.
├── ffprobe-wasm.js
├── ffprobe-wasm.wasm
├── ffprobe-wasm.worker.js

while within NodeJS, In fact if I try to load the module as usal

const Module = require('./ffprobe-wasm.js');
    const versions = {
        libavutil:  Module.avutil_version(),
        libavcodec:  Module.avcodec_version(),
        libavformat:  Module.avformat_version(),
    };

I get an TypeError: Module.avutil_version is not a function error

@loretoparisi loretoparisi reopened this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants