Raspberry Pi camera module commands

To see a list of possible options for running raspivid or raspistill, you can run:

raspivid | less

raspistill | less

Use the arrow keys to scroll and type q to exit.

Still captures

By default, captures are done at the highest resolution supported by the sensor. This can be changed using the -w and -h command line options.

Capture an image in jpeg format:

raspistill -o image.jpg

Taking a default capture after 2s (note times are specified in milliseconds) on viewfinder, saving in image.jpg

raspistill -t 2000 -o image.jpg

Take a capture at a different resolution.

raspistill -t 2000 -o image.jpg -w 640 -h 480

Now reduce the quality considerably to reduce file size

raspistill -t 2000 -o image.jpg -q 5

Force the preview to appear at coordinate 100,100, with width 300 and height 200 pixels.

raspistill -t 2000 -o image.jpg -p 100,100,300,200

Disable preview entirely

raspistill -t 2000 -o image.jpg -n

Save the image as a png file (lossless compression, but slower than JPEG). Note that the filename suffix is ignored when choosing the image encoding.

raspistill -t 2000 -o image.png –e png

Add some EXIF information to the JPEG. This sets the Artist tag name to Boris, and the GPS altitude to 123.5m. Note that if setting GPS tags you should set as a minimum GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, GPSAltitude and GPSAltitudeRef.

raspistill -t 2000 -o image.jpg -x IFDO.Artist=Boris -x GPS.GPSAltitude=1235/10

Set an emboss style image effect

raspistill -t 2000 -o image.jpg -ifx emboss

Set the U and V channels of the YUV image to specific values (128:128 produces a greyscale image)

raspistill -t 2000 -o image.jpg -cfx 128:128

Run preview ONLY for 2s, no saved image.

raspistill -t 2000

Take timelapse picture, one every 10 seconds for 10 minutes (10 minutes = 600000ms), named image_num_001_today.jpg, image_num_002_today.jpg onwards, with the latest picture also available under the name latest.jpg.

raspistill -t 600000 -tl 10000 -o image_num_%03d_today.jpg -l latest.jpg

Take a picture and send image data to stdout

raspistill -t 2000 -o -

Take a picture and send image data to file

raspistill -t 2000 -o - > my_file.jpg

Run camera forever, taking a picture when Enter is pressed

raspistill -t 0 -k -o my_pics%02d.jpg

Video Captures

Image size and preview settings are the same as for stills capture. Default size for video recording is 1080p (1920×1080)

Record a 5s clip with default settings (1080p30)

raspivid -t 5000 -o video.h264

Record a 5s clip at a specified bitrate (3.5MBits/s)

raspivid -t 5000 -o video.h264 -b 3500000

Record a 5s clip at a specified framerate (5fps)

raspivid -t 5000 -o video.h264 -f 5

Encode a 5s camera stream and send image data to stdout

raspivid -t 5000 -o -

Encode a 5s camera stream and send image data to file

raspivid -t 5000 -o - > my_file.h264

2 thoughts on “Raspberry Pi camera module commands”

Leave a Comment

Your email address will not be published. Required fields are marked *