title: Convert Numpy Array to Video(mp4)
body: <p>I have a video(mp4) that I read into a Numpy Array and edit. Now I want to convert the array back to a video</p>
  
  <p>I already tried to use VideoWriter but the created mp4 was always corrupt</p>
  
  <pre><code>frame_array = []
  with detection_graph.as_default():
    with tf.Session(graph=detection_graph) as sess:
      while cap.isOpened():
        ret, image_np = cap.read()
        if ret == True:
            image_np_expanded = np.expand_dims(image_np, axis=0)
            image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
            boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
            scores = detection_graph.get_tensor_by_name('detection_scores:0')
            classes = detection_graph.get_tensor_by_name('detection_classes:0')
            num_detections = detection_graph.get_tensor_by_name('num_detections:0')
            (boxes, scores, classes, num_detections) = sess.run(
                [boxes, scores, classes, num_detections],
                feed_dict={image_tensor: image_np_expanded})
            vis_util.visualize_boxes_and_labels_on_image_array(
                image_np,
                np.squeeze(boxes),
                np.squeeze(classes).astype(np.int32),
                np.squeeze(scores),
                category_index,
                use_normalized_coordinates=True,
                line_thickness=8)
            i=i+1
            frame_array.append(image_np)
            cv2.imwrite('pictures/'+ str(i) + '.jpg',image_np)
        else:
            break
  print("Everything detected")
  out = cv2.VideoWriter('video.mp4',cv2.VideoWriter_fourcc(*'DIVX'), 30, (640, 480))
  for i in frame_array:
      out.write(i)
  out.release()
  </code></pre>
  
  <p>The created mp4 was always corrupt and couldnt be opened. Every saved Picture with <code>cv2.imwrite</code> is okay and viewable</p>