I wrote a nodejs addon, compiled with node-gyp. It won't work on electron, but nodejs worked. The nodejs and electron node has the same version.
The addon do these things:
In electron, the follow codes always return Protol not found
int status = avformat_open_input(&pFormatContext, url, NULL, NULL);
if (0 != status) {
av_log(NULL, AV_LOG_ERROR, "ffmpeg open error: %s\n", av_err2str(status));
return status;
}
The node-gyp configurations:
{
"targets": [{
"target_name": "ffmpeg",
"sources": ["src/ffmpeg/api/addon.c", "src/ffmpeg/api/ffmpeg.c"],
"include_dirs": [
"/home/my/ffmpeg_build/include"
],
"libraries": [
"-L$$PWD/../lib/ffmpeg-kylinux-aarch64",
"-lavformat",
"-lavcodec",
"-lavutil",
"-lswscale",
"-lswresample",
"-lx264",
"-lx265"
]
}]
}
Electron already includes ffmpeg (unlike stock Node.js) leaving you no other choice but to link with the included version - otherwise you will get symbol clashes and weird behavior - which is your case - because some symbols will be resolved to your version, others to the built-in version.
Maybe there is a possible workaround which is to build ffmpeg statically into your addon.