open (cv.VideoCapture) - MATLAB File Help
cv.VideoCapture/open

Open video file or a capturing device or a IP video stream for video capturing

successFlag = cap.open(index)
successFlag = cap.open(filename)
successFlag = cap.open(..., 'API',apiPreference)

Input

Output

Options

The method first calls cv.VideoCapture.release to close the already opened file or camera.

Example

Use API option to enforce a specific reader implementation if multiple are available like 'FFMPEG' or 'Images' or 'DirectShow'. For example, to open camera 1 using the "MS Media Foundation" API:

cap.open(1, 'API','MediaFoundation')

Note

Backends are available only if they have been built with your OpenCV binaries. Check your build to know which APIs are currently available. To enable/disable APIs, you have to re-configure OpenCV using the appropriates CMake switches and recompile OpenCV itself.

See also
Method Details
Access public
Sealed false
Static false