Without looking at the code, this is what I recommend.
Put that frames in a generator.
If you use a function to generate the data, use yield instead of return. That means that data can be consumed on the go without consuming memory.