node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

Error: Video file could not be opened (opencv reqs. non relative paths)

Open sbhal opened this issue 9 years ago • 2 comments

Unable to execute examples/motion-track.js script.

var vid = new cv.VideoCapture(path.join(__dirname, 'files', 'motion.mov')); ^

Error: Video file could not be opened (opencv reqs. non relative paths) at Error (native) at Object. (/home/sbhal/Documents/fogComputingFaceDetection/edgeDevice/node_modules/opencv/examples/motion-track.js:5:11) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Function.Module.runMain (module.js:447:10) at startup (node.js:140:18) at node.js:1001:3

sbhal avatar Mar 19 '16 23:03 sbhal

@sbhal I was able to run this when I was in my project home directory and the opencv home directory. I'm on node v0.12.13 and I made sure that the library was working before trying this.

// When opening a file, the full path must be passed to opencv
var vid = new cv.VideoCapture(path.join(__dirname, 'files', 'motion.mov'));

Is it possible you're running this command from a directory that prevent some of the code from finding the file? You could add some logging to the example file and check that you're getting a reasonable path to your file.

johnelliott avatar Apr 07 '16 13:04 johnelliott

I am running into the same problem. The following function call:

var vid = new cv.VideoCapture('test.avi')

is giving this error Error: Video file could not be opened (opencv reqs. non relative paths).

I was able to read test.avi as expected when I was using ffmpeg var process = new ffmpeg(tmpobj.name); and then capture frames from the video. I want to be able to use opencv though.

My nodejs version is v8.12.0, and I am using the release 5.0 for opencv (the library failed to download with later versions of nodejs, and the release 6.0 of opencv gave errors as well).

I am using linux on Ubuntu 16.04.4.

christegho avatar Nov 26 '18 17:11 christegho