title: How Can I Write A Function to split a video into its frames?
body: <p>I was trying to write a function on Python that can split the frames of a video which I will later on use for deep learning purposes. It seems like there was no problem it created the files but when I open them, there is nothing inside.</p>
  
  <p>Python, Visual Studio, OpenCV</p>
  
  <pre class="lang-py prettyprint-override"><code>import cv2
  import matplotlib.pyplot as plt
  import numpy as np
  
  video=cv2.VideoCapture('teknofest.mp4')
  ret,frame=video.read()
  
  def getFrames(vid):
      count=0
      for item in frame:
          cv2.imwrite(filename='frame%d.jpg' %count,img=item)
          print('WRITTEN FRAME:',count)
          count+=1
      return frame
  
  getFrames(video)
  </code></pre>
  
  <p>.
  I was hoping to get the frames but it just gave me 719 blank photos</p>