Gstreamer error when running VideoCapture

asked 2016-02-11 02:07:56 -0600

kam7 gravatar image

Hi, when I run the following program to play a video from a mp4 file using opencv(cv2), I get gstreamer errors.

import numpy as np
import cv2

cap = cv2.VideoCapture("play.mp4")

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

Errors: (python:19932): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GstObject'

(python:19932): GStreamer-CRITICAL **: gst_object_unref: assertion '((GObject *) object)->ref_count > 0' failed

(python:19932): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GstObject'

(python:19932): GStreamer-CRITICAL **: gst_object_unref: assertion '((GObject *) object)->ref_count > 0' failed

(python:19932): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GstObject'

(python:19932): GStreamer-CRITICAL **: gst_object_unref: assertion '((GObject *) object)->ref_count > 0' failed

(python:19932): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

(python:19932): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

(python:19932): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed

I have tried it on two different computers(same OS) and I get the same problem on both of them. Please suggest how to get rid of the warnings.

edit retag flag offensive close merge delete