add "left is top" bit that flips video 180 degrees if things are not in the expected direction
remove unneeded imports
write png instead of jpeg image to work around libjpeg problems