moved video reading to its own file, added basic histogram detection