How can I convert a video file (mpeg, for example) into a collection of images?

Ideal answer would cover both C++ and Java using available libraries, and also how to manually strip the individual frames out of a video file for some common video format.