Raspberry PI 3无法保存视频

时间:2016-04-18 23:11:56

标签: raspberry-pi raspberry-pi3

以下代码适用于我的raspberry pi 3(raspbian unix OS)。我可以看到视频预览10秒钟。 (所以看起来相机安装正确)。

from camera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(10)
camera.stop_preview()
camera.close()

但如果我尝试通过

将预览保存到文件中
from camera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
camera.start_recording("./foo.h264")
sleep(10)
camera.stop_recording()
camera.stop_preview()

然后我收到错误

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Traceback (most recent call last):
  File "CaptureVideo.py", line 3, in <module>
    camera = PiCamera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 488, in __init__
    self.STEREO_MODES[stereo_mode], stereo_decimate)
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 620, in _init_camera
    prefix="Camera component couldn't be enabled")
  File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 191, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled: Out of resources (other than memory)

我确实谷歌提供了错误信息,但没有找到具体的答案。

编辑::我的gpu_mem在/boot/config.txt

中是128

Edit2 ::我在github上找到了这个项目

https://github.com/ashtons/picam

我安装了这个项目,并编写了以下代码

import picam
import time
picam.recordVideoWithDetails('./foo.h264', 640, 480, 10000)

它工作并记录了视频。视频看起来好像快进了。但它起作用了,并没有耗尽资源。

所以现在问题是PiCamera模块有什么问题

0 个答案:

没有答案