Lossless extracting of JPEGs from an MJPEG video
The easiest way is to use ffmpeg or avconv.

The command:

ffmpeg -i mjpegvideo.avi -vcodec copy frame%d.jpg


will create a series of jpeg without reencoding.