title: Multi Processing in python
body: <p>I am trying to record Set top box signal using videorecording feature of opencv in python.
  I am using capture device to capture the set top box signal whose FPS is 30.
  Video Recording from External capture device is successful using opencv.</p>
  <p>Here is the code for video recording</p>
  <pre><code>#VideoRecord.py
  CaptureDeviceID = 1
  cap = VideoCapture(CaptureDeviceID)
  if cap.isOpened():
      cap.set(CV_CAP_PROP_FRAME_WIDTH, 640)
      cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480)
  else:
      exit()
  
  fourcc = cv2.cv.CV_FOURCC()
  out = cv2.VideoWriter('output.avi',fourcc, 30.0, (640,480))
  
  while(cap.isOpened()):
      frameNo = 0
      ret, frame = cap.read()
      if ret==True:
          frameNo++
          # write the frame
          out.write(frame)
      
          if (frameNo &gt; 150):
              break
      else:
          break
  
  # Release everything if job is finished
  cap.release()
  out.release()
  cv2.destroyAllWindows()
  </code></pre>
  <p>Now through Script I am changing channel using IRBlaster command.
  This channel change should come in recorded video.</p>
  <h1>code for sending channel+ command</h1>
  <pre><code># sendCommand.py
  redrat_path = r'C:\Program Files\RedRat\RedRat Control\RR_CLI_V3.01\RR_CLI.exe
  redrat_process=subprocess.Popen(\&quot;%s %s\&quot; % (redrat_path,\&quot;RedRat-0  -output RedRatDB.xml  -device STB1 -signal  Channel+ &quot;))
  </code></pre>
  <p>In words I want to record video and  send command in parallel process.So that the created video file has this
  channel change event recorded.</p>
  <p>How should I achieve this effectively so that I will not miss any frame while I am sending channel change command?.
  Do i have to use threading?</p>
  <p>Please suggest some ideas.I want to use Python</p>