Ask Your Question

Revision history [back]

Alter the video dimensions

As shown in the code below, currently I am getting video to save at 640X480, however I'm looking to modify the dimensions of the saved video. Every time I attempt to simply change the parameters within the parentheses, I get this error: "warning: Error pushing buffer to GStreamer pipeline (/builddir/build/BUILD/opencv-2.4.12.3/modules/highgui/src/cap_gstreamer.cpp:1609)"

I'm using Python 2.7, and I'm assuming the issue is trying to send too much information/data from the video. I was hoping someone would be able to help out a little. Thanks :)

import numpy as np import cv2

video = cv2.VideoCapture(0)

fourcc = cv2.cv.CV_FOURCC(*'MJPG') out = cv2.VideoWriter('sample.avi',fourcc,15.0, (640,480))

while video.isOpened(): ret, frame = video.read() if ret == True: out.write(frame)

    cv2.imshow('frame',ret)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
else:
    break

cap.release() out.release() cv2.destroyAllWindows()