Permute the images to 30x512x512 and now you can treat it as batch of 30 images
then reshape this to 30x1x512x512 so you get channel 1 for all 30 images.
if img is 512x512x30 do following
img = img.permute(2, 0, 1)
img = torch.reshape(img, (30, 1, 512, 512))