node-opencv
node-opencv copied to clipboard
Error: Video file could not be opened (opencv reqs. non relative paths)
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.
@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.
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.