Can't grab frame

So i downloaded the sdk and generated a project using CMake
But when i run the sample code it just opens the video window for a few seconds before closing and it gives me this error on command prompt: “videoio(MSMF): can’t grab frame. Error: -2147483638
ERROR: Video error”

I get this error no matter which .exe i run

Which platform are you on? Are there multiple video input devices connected?
You can try forcing the Video Capture API to CAP_DSHOW instead of the problematic CAP_MSMF by adding it as second argument to the VideoCapture.open function.

For example in the ExpressionApp sample:

NvCV_Status App::setInputCamera(int index, const std::string& resStr) {
  if (!_vidIn.open(index, cv::VideoCaptureAPIs::CAP_DSHOW))
    return NvFromAppErr(APP_ERR_OPEN);
 //...
}

However it also might by a driver or hardware compatibility issue with your video input device.