-
-
Notifications
You must be signed in to change notification settings - Fork 211
/
hero9_timelapse_webcam.py
42 lines (32 loc) · 1.37 KB
/
hero9_timelapse_webcam.py
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
import sys
import time
from goprocam import GoProCamera, constants
import threading
import logging
"""
I use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly.
pm2 start timelapse.py --cron "30 7 * * *" --log timelapse.log --no-autorestart
This script will overrride some settings for reliability:
Voice control: OFF
AutoPower off: NEVER
Beeps: OFF (Do not want the camera beeping at 6AM)
NightLapse configuration left untouched, I recommend always using Auto shutter for sunrise and locking the White Balance to 4000k or higher.
"""
def start_timelapse(interface):
gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP(
interface), camera=constants.gpcontrol, webcam_device=interface)
logging.info(
"Started goprocam instance with interface {}".format(interface))
gopro.gpControlSet(constants.Setup.VOICE_CONTROL,
constants.Setup.VoiceControl.OFF)
gopro.gpControlSet(constants.Setup.AUTO_OFF, constants.Setup.AutoOff.Never)
logging.info("All config set")
gopro.mode(constants.Mode.MultiShotMode,
constants.Mode.SubMode.MultiShot.NightLapse)
gopro.shutter(constants.start)
logging.info("Started timelapse")
cameras = sys.argv[1]
cameras = cameras.split(",")
for interface in cameras:
thr = threading.Thread(target=start_timelapse, args=(interface,))
thr.start()