Fixed the flipping. Minor improvements.
Added support for choosing video resolution and frame rate.