Dataloader continuous sampling

I’m trying to figure out how to write a dataloader that does this:

Generate Batch 1 using videos A, B,C and frames [0-10] from each.

Generate Batch 2 using videos A, B, C and frames [5-15].

Any ideas? or reference code?

On every epoch, I want a random order on the videos, but I want to maintain the sequence on the frames.