No videofile CV3.1+Python3+Ubuntu14.04

asked 2016-01-03 06:08:47 -0600

I have problem with writing video to file. This small program:

import numpy as np
import cv2
import time

cap = cv2.VideoCapture(0)

time.sleep(0.1)

# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc('X','2','6','4')
out = cv2.VideoWriter('output.avi',fourcc, 25, (640,480))

while(cap.isOpened()):
    ret, frame = cap.read()
    if ret==True:

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

# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()

I see the frames in the window but no outputfile are generated. Nor any errors shown. What am I doing wrong?

edit retag flag offensive close merge delete

Comments

Tried reenstalling according to this recommendation: http://askubuntu.com/questions/537268... Seems that there is something wrong with the dependencies: libavcodec-dev : Depends on: libavcodec54 (<= 6:9.18-99) but 7:1.2.6-1~trusty1 will be installed or libavcodec-extra-54 (<= 6:9.18-99) but it will not be installed

JAndersM gravatar imageJAndersM ( 2016-01-04 06:47:14 -0600 )edit

Solved! Removed kxstudio packages that caused the problem.

JAndersM gravatar imageJAndersM ( 2016-01-04 12:52:53 -0600 )edit