title: Running two videos with OpenCV python with multi threading
body: <p>I am trying to run on python using openCV two functions at the same time. One function is supposed to show local video and the other should show frames from my webcam. When running the code below, the two windows freezes and blacks out. I am running it on Ubuntu 16.04</p>
  
  <pre><code>import cv2
  import numpy as np
  from threading import Thread
  
  def webcam_video(): 
  
    cap = cv2.VideoCapture(0)
    while(True):
      ret, frame = cap.read()
      if ret == True:
        cv2.imshow('frame',frame)
        if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
      else :
          break
    cap.release()
    cv2.destroyAllWindows()
  
  def local_video(): 
    path = "video-1.mp4"
    cap = cv2.VideoCapture(path)
    while(True):
      ret, frame = cap.read()
      if ret == True:
       cv2.imshow('frame_2',frame)
       if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
      else :
          break     
    cap.release()
    cv2.destroyAllWindows()
  
  t1= Thread(target = webcam_video)
  t2= Thread(target = local_video)
  
  t1.start() 
  t2.start()
  </code></pre>