# Revision history [back]

Hi dmcenan!

This works thanks to the magic of OOP (Object Oriented Programming), you can checkout the source code of highgui/src/cap.cpp where the overloaded >> is implemented (as you observed) and if you follow the track of that overloaded method you will reach the file highgui/src/cap_ffmpeg_impl.hpp which implements the method:

CvCapture_FFMPEG::grabFrame()


That method is in charge of grabbing a frame from a video file source, and at some point after some checks and decodification stuff, there is a wonderful

frame_number++


Which causes the VideoCapture object give you the next frame on the video stream the next time you call cap >> frame

I hope this helps.