Take multiple pictures on demand using Raspberry Pi python code

The python code below takes as many pictures you want as long as you keep pressing enter and saves images in a specified folder (in this case "images") with image names "image1.jpg" , "image2.jpg", etc., from picamera import PiCamera from time import sleep camera = PiCamera() camera.rotation = 270 i = 0 while not raw_input("Press enter for a photo"):    i = i + 1    camera.start_preview(alpha=200)    sleep(1)    image_path = "./images/image"+str(i)+".jpg"    camera.capture(image_path)    camera.stop_preview()    print("image successfully saved in the path: "+image_path) Important things to remember You could also use input() instead of raw_input() function based on the python version. make sure the folder exists already. This code might not create a new folder. Do while in python doesn't exist.

Raspberry - Record a video for x minutes / x hours using command line option

raspivid record video using CLI

The default option records for 5 minutes. We could override the default options using -t option on the raspivid command line interface.

-t option defines the recording time in milliseconds
1 second = 1000 milliseconds
5 seconds = 5000 milliseconds
1 minute = 60 seconds = 60000 milliseconds
1 hour = 60 minutes = 60 x 60 seconds = 3600 = 3600000 milliseconds

example:
raspivid -o ./vid1.h264 -h 600 -w 600 -rot 180 -sa 50 -t 10000

Comments

Popular posts from this blog

Take multiple pictures on demand using Raspberry Pi python code

Raspberry camera [raspistill] image options