writing video to a file