processing video frames with CUDA

Hello everybody,

I’d like to process video frames using CUDA (in the first time, applying a filter on each frame) and I do not succeed in getting informations on the subject.
I’d like to know if there is a simple way to grab the frames from a yuv video with CUDA and what is the most efficient way to send the data on the GPU (frame by frame ? or as many frames that could fit in the global/texture memory ? )

Thanks for your help !

Are you grabbing the video live from a camera, or is it stored in a file? Are you using Windows, Linux, or Mac?

I don’t know about Linux/Mac, but the easiest way on Windows is to use DirectShow to build a filter graph to open the file (or video device), then for each frame you grab it, process it, then write it back to another file. If you’re reading from a file, it would probably be most efficient to send/process multiple frames to the device at once, unless you’re dealing with some really high-resolution footage.

I should have described my work environment :mellow: I use Windows and the video is stored in a file. Actually, I have just finished to design a motion estimation program running with CUDA which takes two frames in input and I’d like to run it on a whole video.

Thanks for DirectShow, I’ll try it just after I’ll finish writing this post !

Your last phrase raises the next problem I’ll have after reading each video frame. Do you know if thre is any “rules” or publication dealing with what is the best number of frames to send on the GPU considering the complexity of the whole CUDA process and the resolution of the frames ?

Try the “cuVid” CUDA extensions for video processing. The API allows access to the in-built “Video Processor” which can automatically decode MPEG and other frames to YUV frames in the device memory… And from there, you can launch CUDA kernels to process them