alfg/ffprobe-wasm

Nodejs support

Opened this issue ยท 8 comments

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 commented

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 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 commented

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 ?

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 commented

@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 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

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

@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