Refactoring video generation to allow longer videos and fix memory issues during that generation