.avi output file does not play

asked 2014-05-21 23:43:47 -0500

zjpahle gravatar image

Hello,

I apologize if this got answered somewhere else, but after some time looking I haven't been able to find a solution.

I am trying to record video using the VideoStream class. I am running a clean install of Ubuntu 12.04, and I pulled from the repo a few weeks ago, so I should be fairly up to date.

My code is as follows:

from SimpleCV import *
import time

cam = Camera()
vs = VideoStream("out.avi", 25, True)

for i in range(0, 125):
    cam.getImage().save(vs)
    time.sleep(.05)

With the output: Output #0, avi, to 'out.avi': Stream #0.0: Video: rawvideo, bgr24, 640x480, q=2-31, 19660 kb/s, 90k tbn, 25 tbc

The code runs successfully, but when I try to play the avi file the player (either mplayer or vlc) opens the file but just sits blankly at (0:00).

If instead I use writeFrame() instead of save() it plays the file, but the data is all messed up (there is color and parts of the correct image but severly contorted). I can also pull individual jpgs just fine.

Any suggestions as to how I could fix this? What are the other file formats supported by VideoStream?

As a secondary problem, the framerate is unreasonably slow (as in seconds per frame at times). Am I doing something inefficient with the code, or is my machine just not powerful enough?

edit retag flag offensive close merge delete