Getting frames from video

I’m using the DrawDibDraw(…) function to get the bitmap from a frame…and then using glTexSubImage2D(); to send it to OpenGL…but for a video with size of 512x512, it runs slowly…what is the fastest combination for loadind it (format of the video, function to get the frame and function to send it to opengl)?