writing video out to a file