Syntax error fixed in this script.
In this python script, I added "import rospy" to be able to run this script in a Catkin environment.

Then, I removed the option "sameq" of the ffmpeg process. In ubuntu 14.04, ffmpeg is now called avconv, on my computer I have a symlink from avconv to ffmpeg, so calling ffmpeg still work. But with this version of FFMPEG (avconv 9.16), there is nolonger the sameq argument. Maybe it could be interesting to call avconc and rather than ffmpeg is ffmpeg executable is not found...
This is the "intersting" patch I did : Now extract_image works also with rosbag containing compressed images, if these images are decodable by opencv (this is the case for JPG and PNG compression).