justadudewhohacks / justadudewhohacks/opencv4nodejs

gstreamer "shenanigans" on OSX

Open
#601 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

_More of a PSA than an issue, so feel free to delete/close at will._

Suddenly (I had to run this particular code for a few months and had updated some things on the system) the VideoWriter would no longer write to a gStreamer sink ...

```
var w1 = 'appsrc ! queue ! videoconvert ! queue ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! queue ! rtph264pay config-interval=1 ! queue ! udpsink host=127.0.0.1 port=5001 sync=false';
var fourcc = cv.VideoWriter.fourcc('avc1'); // encoder
const vw1 = new cv.VideoWriter(w1, fourcc, fps, new cv.Size(width, height), true);
```

When attempting to write you would get the mysterious message ...

```AVDCreateGPUAccelerator: Error loading GPU renderer```

... followed by `could not save` errors for each frame being written out through the writer.

After some playing around it seems that gStreamer was not being found during the `opencv-build` phase of the install and therefore the gStreamer capability was not available etc.

gStreamer has been installed on the system for quite sometime but had been updated (through `brew`) a couple of times since I had last ran the code. And it appears that the problem is a missing pc file (required for pkg-config) on one of the dependencies (libffi).

So if you come across something similar then ...

```
cd /usr/local/lib/pkgconfig
ln -s ../../Cellar/libffi/3.2.1/lib/pkgconfig/libffi.pc libffi.pc
```

.. works like a charm.

(btw. I did try using the system-wide install of opencv@4 and disabling auto build but it didn't work - no errors but no output)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.