title: Extract frames from video into specific folder
body: <p>I want to extract frames from 3 videos into 3 different folder. Each folder has the frames of their corresponding video file. I am able to access my objective for only the 3rd video. How can I extract the frames for the first 2 videos as well</p>
  
  <p>I have made the folders having names as per the video files till now. Developed the code for frame extraction but can extract only from the last video. Below is my code</p>
  
  <pre><code>import cv2
  import glob
  from glob import glob
  import os
  import shutil
  
  def extractFrames(m,n):
  
      if not os.path.exists:
          os.makedirs(n)
  
      vid_files=glob(m)
      print(vid_files)
  
      for v_f in range(len(vid_files)):
          v1=os.path.basename(vid_files[v_f])
          print(v1)
          vid_name = os.path.splitext(v1)[0]
          print(vid_name)
          output = n +'\\video_' + vid_name
          os.makedirs(output)
          print(output)
  
  
  
  
  
      vidcap = cv2.VideoCapture(vid_files[v_f])
      print(vidcap)
      success,image = vidcap.read()
      seconds = 2
      fps = vidcap.get(cv2.CAP_PROP_FPS) # Gets the frames per second
      multiplier = fps * seconds
      count=0
  
      while success:
          img_name = vid_name + '_f' + str(count) + ".jpg"
          image_path = output + "/" + img_name
          frameId = int(round(vidcap.get(1)))
          success,image = vidcap.read()
          if frameId % multiplier == 0:
              cv2.imwrite(filename = image_path, img = image)
              count+=1
  
  
      vidcap.release()
      cv2.destroyAllWindows()
  
      print('finished processing video {0} with frames {1}'.format(vid_files[v_f], count))
      return output
  
  
  x=("C:\\Python36\\videos\\*.mp4")
  y=("C:\\Python36\\videos\\videos_new")
  
  z=extractFrames(x,y)
  </code></pre>
  
  <p>If there are 3 videos namely video1,video2,video3. I want to extract the corresponding frames into their specific folders i.e video1 folder,video2 folder, video3 folder. Currently I am able to extract the frames for only the 3rd video into folder video3. How can I do it for video1 and video2 as well</p>