title: Python OpenCV Images to Video Not all images are displayed in frames
body: <p>I'm trying to create a video out of a list of images using opencv, where I display each picture for 5 seconds. But the code produces a video which shows only 1 image with a duration of 5 seconds (out of 5 images). What am I doing wrong?</p>
  <p>Here's the code:</p>
  <pre><code>
  import cv2
  import os
  dir_path = os.path.dirname(os.path.realpath(__file__))
  
  video_name = 'test/video.avi'
  
  images = ['db\\images\\generic\\COCO_val2017\\000000532901.jpg', 'db\\images\\generic\\COCO_val2017\\000000415990.jpg', 'db\\images\\generic\COCO_val2017\\000000402615.jpg', 'db\\images\\generic\\COCO_val2017\\000000363188.jpg', 'db\\images\\generic\\COCO_val2017\\000000250901.jpg']
  frame = cv2.imread(images[0])
  height, width, layers = frame.shape
  
  video = cv2.VideoWriter(video_name, 0, 1, (width, height))
  
  for image in images:
      for _ in range(5):
          video.write(cv2.imread(image))
  
  cv2.destroyAllWindows()
  video.release()
  
  </code></pre>
  <p>The images are located at a shared location in the network, but even locally the issue exists.</p>
  <p>If I copy about 30~ images, only about ~4 of them will be present at the video.</p>
  <p>What is the issue?</p>