title: Extract metadata from a Video/Image
body: <p>I am getting an MJPEG stream from an IP Camera which I am viewing and saving on my computer. The code of how I am doing it can be found <a href="https://stackoverflow.com/questions/21702477/how-to-parse-mjpeg-http-stream-from-ip-camera">here</a>. The answer explains how to extract the images from the stream and save them.</p>
  
  <p>For extracting the images I am using the method listed in the answer and for saving it I am simply putting the images in an avi container using OpenCV. The code is given below.</p>
  
  <pre><code>writer=cv.CreateVideoWriter("video1.avi", cv.CV_FOURCC('X', '2', '6', '4'), fps, (320,240))
  cv_image = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8),cv2.CV_LOAD_IMAGE_COLOR)bitmap=cv.CreateImageHeader((cv_image.shape[1], cv_image.shape[0]), cv.IPL_DEPTH_8U, 3)
  cv.SetData(bitmap, cv_image.tostring(), cv_image.dtype.itemsize * 3 * cv_image.shape[1])
  cv.WriteFrame(writer, bitmap)
  </code></pre>
  
  <p>Here bitmap is the image that I am displaying and putting in the avi container.</p>
  
  <p>Since the image is from an IP Camera it must have some metyadata like a time stamp which the camera inserts.</p>
  
  <p><strong>Question:</strong> How do I extract the metadata?</p>
  
  <p>I have thought of 2 ways to do this:</p>
  
  <ol>
  <li>Extract the frames from the video and then access them to access the time stamp.</li>
  <li>Extract the time stamp from the video itself.</li>
  </ol>
  
  <p>How do I proceed? Which method do I use? I am using Python and Opencv and am working on Windows 7.</p>
  
  <p>I also read <a href="http://answers.opencv.org/question/20826/how-can-i-extract-metadata-from-video/" rel="nofollow noreferrer">this</a> like related to what I am trying to do. It did not solve my problem.</p>