justadudewhohacks / justadudewhohacks/opencv4nodejs

Add cv.VideoCapture(file, apiPreference) to API

Open
#611 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

I would like to control the driver of what is reading the input video source. Since OpenCV supports FFMPEG (as well as others), and I managed to get opencv4nodejs to compile FFMPEG, I would like to have the option to use the non-default apiPreference as described in:

[OpenCv VideoCapture Api Preferences](https://docs.opencv.org/3.4.4/d8/dfe/classcv_1_1VideoCapture.html#a85b55cf6a4a50451367ba96b65218ba1)

The current constructors of opencv4nodejs take an index, or a filename. This leaves the default up to Opencv, removing the overload from the user.

```
export class VideoCapture {
constructor(filePath: string);
constructor(devicePort: number);
```

My target would be to do something such as:

`video0 = new cv.VideoCapture('/dev/video0', cv.CAP_FFMPEG)`

Note: Mainly thinking about solutions where we may be able to leverage the optimizations of these outside providers, outside of v4l2, or dshow. In the case of hardware GPU decoding on FFMPEG, etc.

*OpenCV version 3.4.6
*With OpenCV-contrib?* yes
*OS*: Ubuntu 18.04.02 LTS

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing VideoCapture constructors and their TypeScript declarations, then consult the linked OpenCV VideoCapture API-preference documentation. Confirm how filename and device-index construction currently reaches OpenCV. Done should mean accepting the requested preference for a video source while preserving the existing constructors.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.