-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcam.py
More file actions
43 lines (36 loc) · 1023 Bytes
/
cam.py
File metadata and controls
43 lines (36 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from picamera import PiCamera
from time import sleep
import argparse
import datetime as dt
import os
import sys
camera = PiCamera()
camera.vflip = True
camera.brightness = 70
camera.sharpness = 40
camera.contrast = 60
camera.saturation = 60
camera.exposure_mode = 'auto'
def record(rec_time, file_path):
camera.start_recording(file_path)
sleep(rec_time)
camera.stop_recording()
def live_feed(feed):
# live feed
while feed:
camera.start_preview()
sleep(10)
camera.stop_preview()
if __name__ == '__main__':
input_parser = argparse.ArgumentParser()
input_parser.add_argument("time", type=int,
help="Recording Time")
input_parser.add_argument("-l", "--live", action="store_true",
help="live Feed")
args = input_parser.parse_args()
if args.live:
live_feed(args.live)
else:
print("Recording")
file_path = str(dt.date) + 'video.h264'
record(args.time, file_path)