ffprobe-wasm icon indicating copy to clipboard operation
ffprobe-wasm copied to clipboard

Nodejs support

Open loretoparisi opened this issue 4 years ago • 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.

loretoparisi avatar Dec 15 '20 16:12 loretoparisi

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 avatar Dec 15 '20 18:12 alfg

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

loretoparisi avatar Dec 15 '20 19:12 loretoparisi

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 avatar Dec 15 '20 20:12 alfg

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

https://github.com/ffmpegwasm/ffmpeg.wasm/issues/121

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

loretoparisi avatar Dec 22 '20 13:12 loretoparisi

@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 avatar Dec 22 '20 21:12 alfg

@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

loretoparisi avatar Oct 19 '22 10:10 loretoparisi

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): https://github.com/alfg/ffprobe-wasm/issues/19

jhurliman avatar Jan 06 '23 00:01 jhurliman

@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 avatar Mar 20 '24 16:03 loretoparisi