Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opening video using Python - cannot find GStreamer

I am trying to do some simple video processing using OpenCV and Python (v2.7.3, running under FC18 64bit) but it looks like I am stuck at the very beginning... opening the video

I am using this very simple code:

import cv2
import cv2.cv as cv

filename = "/home/nico/Documents/test.avi"
vidFile = cv2.VideoCapture(filename)

nFrames = int(vidFile.get(cv.CV_CAP_PROP_FRAME_COUNT))
fps = vidFile.get(cv.CV_CAP_PROP_FPS)

print("Num. frames = ",nFrames)
print("Frame rate = ", fps, " fps")

This results in:

warning: GStreamer: Error opening bin
 (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:354)
('Num. Frames = ', 0)
('Frame Rate = ', 0.0, ' fps')

The file exists and it is readable.

GStreamer seems to be properly installed (packages gstreamer, gstreamer-plugins-*, gstreamer-python) and up-to-date

If I convert the file into ogg and try to open it with the same code I get a different error

warning: GStreamer: unable to query position of stream (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:660)

Any idea how to resolve this problem?

Opening video using Python - cannot find GStreamer

I am trying to do some simple video processing using OpenCV and Python (v2.7.3, running under FC18 64bit) but it looks like I am stuck at the very beginning... opening the video

I am using this very simple code:

import cv2
import cv2.cv as cv

filename = "/home/nico/Documents/test.avi"
vidFile = cv2.VideoCapture(filename)

nFrames = int(vidFile.get(cv.CV_CAP_PROP_FRAME_COUNT))
fps = vidFile.get(cv.CV_CAP_PROP_FPS)

print("Num. frames = ",nFrames)
print("Frame rate = ", fps, " fps")

This results in:

warning: GStreamer: Error opening bin
 (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:354)
('Num. Frames = ', 0)
('Frame Rate = ', 0.0, ' fps')

The file exists and exists, it is readable. readable and works perfectly under various video players.

GStreamer seems to be properly installed (packages gstreamer, gstreamer-plugins-*, gstreamer-python) and up-to-date

If I convert the file into ogg and try to open it with the same code I get a different error

warning: GStreamer: unable to query position of stream (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:660)

Any idea how to resolve this problem?

click to hide/show revision 3
Added information about error

Opening video using Python - cannot find GStreamerplay video

I am trying to do some simple video processing using OpenCV and Python (v2.7.3, running under FC18 64bit) but it looks like I am stuck at the very beginning... opening the video

I am using this very simple code:

import cv2
import cv2.cv as cv

filename = "/home/nico/Documents/test.avi"
vidFile = cv2.VideoCapture(filename)

nFrames = int(vidFile.get(cv.CV_CAP_PROP_FRAME_COUNT))
fps = vidFile.get(cv.CV_CAP_PROP_FPS)

print("Num. frames = ",nFrames)
print("Frame rate = ", fps, " fps")

This results in:

warning: GStreamer: Error opening bin
 (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:354)
('Num. Frames = ', 0)
('Frame Rate = ', 0.0, ' fps')

The file exists, it is readable and works perfectly under various video players.

GStreamer seems to be properly installed (packages gstreamer, gstreamer-plugins-*, gstreamer-python) and up-to-date

If I convert the file into ogg and try to open it with the same code I get a different error

warning: GStreamer: unable to query position of stream (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:660)

Any idea how to resolve this problem?

EDIT: after some Googling and looking at the cap_gstreamer.cpp file I finally realised I was misinterpreting the error. OpenCV finds GStreamer allright, but it seems it cannot create a GstBin object. The error comes from a call to gst_parse_bin_from_description. Anyone has any idea of why that is and what can I do about it?

Opening video using Python - cannot play video

I am trying to do some simple video processing using OpenCV and Python (v2.7.3, running under FC18 64bit) but it looks like I am stuck at the very beginning... opening the video

I am using this very simple code:

import cv2
import cv2.cv as cv

filename = "/home/nico/Documents/test.avi"
vidFile = cv2.VideoCapture(filename)

nFrames = int(vidFile.get(cv.CV_CAP_PROP_FRAME_COUNT))
fps = vidFile.get(cv.CV_CAP_PROP_FPS)

print("Num. frames = ",nFrames)
print("Frame rate = ", fps, " fps")

This results in:

warning: GStreamer: Error opening bin
 (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:354)
('Num. Frames = ', 0)
('Frame Rate = ', 0.0, ' fps')

The file exists, it is readable and works perfectly under various video players.

GStreamer seems to be properly installed (packages gstreamer, gstreamer-plugins-*, gstreamer-python) and up-to-date

If I convert the file into ogg and try to open it with the same code I get a different error

warning: GStreamer: unable to query position of stream (/builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:660)

Any idea how to resolve this problem?

EDIT: after some Googling and looking at the cap_gstreamer.cpp file I finally realised I was misinterpreting the error. OpenCV finds GStreamer allright, but it seems it cannot create a GstBin object. The error comes from a call to gst_parse_bin_from_description. Anyone has any idea of why that is and what can I do about it?