Reading a video file in CUDA

Can anybody suggest the code/method/function of how to read a video file and extract frame from it in order to find the co-relation between the frames.Currently we are using MATLAB for our purpose to read a video and extract the frames from it,we want to implement that in CUDA but we are unable to do that.

“Currently we are using MATLAB for our purpose to read a video and extract the frames from it,we want to implement that in CUDA but we are unable to do that.”

if matlab already has access to the frames, an intermediate solution may be to have matlab pass such frames to cuda for processing, i think