Hello, I suggest something like this,
# store the first frame
>>> frame = torch.rand(3, 500, 500)
>>> batch_frame = frame

# loop over over frame here
batch_frame = torch.stack((batch_frame, new_frame))

If you loop 29 times batch_frame will have a shape of (30, 3, 500, 500).