title: OpenCV: FFMPEG: tag 0xffffffff/'����' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)')'
body: <p>I am trying to save a background subtracted video in python and the following is my code. </p>
  
  <pre><code>import cv2
  import numpy as np
  
  capture = cv2.VideoCapture('MAH00119.mp4')
  size = (int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)),
  int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
  fourcc = cv2.VideoWriter_fourcc(*'X264')
  out = cv2.VideoWriter('output.mp4', -1 , 20.0 , size)
  fgbg= cv2.createBackgroundSubtractorMOG2()
  
  while True:
      ret, img = capture.read()
      if ret==True:
          fgmask = fgbg.apply(img)
          out.write(fgmask)
          cv2.imshow('img',fgmask)
  
      if(cv2.waitKey(27)!=-1):
          break
  
  capture.release()
  out.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>However, this keeps throwing the following error: "OpenCV: FFMPEG: tag 0xffffffff/'����' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)')'"</p>
  
  <p>I have FFMPEG installed and have added it to the environment variables. My background subtraction code without having to save to a file works fine, so I know there's nothing wrong with openCV installation. I am stuck at this place. I know that my python doesn't seem to recognize FFMPEG but I don't know what else to do apart from adding FFMPEG to the environment variables.
  I am using OpenCV version 3.2 on Windows 10 and Python 2.7.</p>
  
  <p>Any help will be much appreciated!</p>