Let me show some examples
example 1: use OpenCV and do transforms for each image
transform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
frames = []
for index in range(2):
    # read image
    frame = (np.random.rand(256, 256, 3) * 255).astype(np.uint8)

    # resize image
    frame = frame * (1/255)
    frame = cv2.resize(frame, (224, 224))
    frame = transform(frame)
    if index == 0:
        frames = [frame]
        continue
    frames.append(frame)

frames = torch.stack(frames)

example 2: use OpenCV and do transform after collecting all images
frames = []
for index in range(2):
    # read image
    frame = (np.random.rand(256, 256, 3) * 255).astype(np.uint8)

    # resize image
    frame = frame * (1/255)
    frame = cv2.resize(frame, (224, 224))
    frame = np.transpose(frame, (2, 0, 1))
    if index == 0:
        frames = [frame]
        continue
    frames.append(frame)

frames = np.stack(frame, axis=0)
# transform
mean, std = torch.tensor([0.485, 0.456, 0.406]), torch.tensor([0.229, 0.224, 0.225])
frames = (torch.from_numpy(frames) - mean[None, :, None, None]) / std[None, :, None, None]