Documentation
Connecting The Camera
Ensure the Raspberry Pi board is not powered and connect the camera cable as shown:
Setup For Camera Use
Ensure the operating system is up to date by using these two commands:
sudo apt-get update
sudo apt-get upgrade
Then run the config tool:
sudo raspi-config
Select the 'Enable Camera' option and set it to Enabled.
Exit the config tool and after it reboots enter the following command to test the camera:
raspistill -v -o
A preview of the camera should be shown for a few seconds.
Taking A Picture Using Raspistill
raspistill -v -o save_as_filename.jpg
By default captures are done at the highest resolution supported by the sensor.
Options
Show all available Options
raspistill --help
The RaspiCam documentation has a full description of all the options.
Recording Video Using Raspivid
The default size for video recording is 1080p (1920×1080)
Record a 5 second video clip example:
raspivid -t 5000 -o save_as_filename.h264
Options
Show all available Options
raspivid --help
Recording Audio With Your Videos
We've not had need to do this yet – if anyone's found a good solution please comment below!
Possible solutions:
https://github.com/iizukanao/picam
Other resources
https://hmbd.wordpress.com/2016/08/01/raspberry-pi-video-and-audio-recording-and-streaming-guide/