title: Error message when I save my video with OpenCV
body: <p>I'm having an error when I run my code, I don't understand what is happening but I think is when the program finish because I have the result what I want, that is convert an existing video to gray scale and save it.</p>
  
  <blockquote>
    <p>cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'</p>
  </blockquote>
  
  <pre><code>cap = cv2.VideoCapture('videos/output.avi')
  fourcc = cv2.VideoWriter_fourcc(*'XVID')
  out = cv2.VideoWriter('results/output.avi', fourcc, 20.0, (640, 480))
  
  while (cap.isOpened()):
      _, frame = cap.read()
      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  
      out.write(frame)
  
      # Key events
      key = cv2.waitKey(1)
      if key == 27:  # esc
          break
  
  cap.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>Thank you!</p>