1. Raspberry Pi camera software
一旦安装好Pi摄像头,RBP的开发者们提供了两个简单但强大的命令行工具,用来直接对摄像头获取的图像或视频流进行保存或分流
raspivid is a command line application that allows you to capture video with the camera module
raspistill allows you to capture images
Example Commands
(http://www.raspberrypi.org/archives/3890)
Capture an image in jpeg format:
raspistill -o image.jpg
Capture a 5s video in h264 format:
raspivid -o video.h264
Capture a 10s video:
raspivid -o video.h264 -t 10000
Capture a 10s video in demo mode:
raspivid -o video.h264 -t 10000 -d
To see a list of possible options for running raspivid orraspistill, you can run:
raspivid | less
raspistill | less
How to install the Raspberry Pi camera module
http://www.techradar.com/news/computing-components/peripherals/how-to-install-the-raspberry-pi-camera-module-1172034
Display a five-second demo: raspivid -d
Display a 640x480 preview: raspivid -p 0,0,640,480
Capture 20s of h264 video: raspivid -t 20000 -o video.h264
Take a 640x480 shot: raspistill -o image.jpg -w 640 -h 480
Take a reduced quality JPEG: raspistill -o image.jpg -q 5
2. Streaming video in RBP native way (Without OpenCV)
RBP的作者们还演示了一种通过网络stream视频流的方式。
在Pi上需要用到raspivid和netcat
raspivid -t 999999 -o – | nc [insert the IP address of the client] 5001
在客户端(包括Linux, Windows和Mac)运行netcat和mplayer即可。比如Linux下只要:
nc -l -p 5001 | mplayer -fps 31 -cache 1024 -
但我如果运行上面命令则直接退出,
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
Exiting... (End of file)
运行
nc.traditional -l -p 5001 | mplayer -fps 31 -cache 1024 -
就一切正常。