代码语言:javascript复制
https://github.com/KonradIT/gopro-py-api
上个PyHero,我写着写着,气氛不太对~,我重新写一个吧.上个不鸽,我气氛对了再写.
适用于Python的非官方GoPro API库-通过WiFi连接到GoPro。
先clone库,看看结构
安装
从 PyPi:
代码语言:javascript复制pip install goprocam
Git (不稳定):
代码语言:javascript复制git clone http://github.com/konradit/gopro-py-api
cd gopro-py-api
python setup.py install
输出结果,开始研究~
今日主角.GoPro Hero4 Black
开机,进设置.打开WIFI
电脑搜索,并连接相机
跑一段程序.~~~
相机成功执行!!!!
电脑端的输出信息
代码语言:javascript复制from goprocam import GoProCamera, constants
goproCamera = GoProCamera.GoPro()
goproCamera.shoot_video(10)
代码语言:javascript复制test_has_sd_card (__main__.MainTests) ... Needs an SD card
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_photo_mode (__main__.MainTests) ... PHOTO MODE
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_power_off (__main__.MainTests) ... POWER OFF
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_power_on (__main__.MainTests) ... POWER ON
Waking up...
Waking up...
ok
test_recording_status (__main__.MainTests) ... isRecording
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_shoot_video (__main__.MainTests) ... shoot_video(5)
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_shutter (__main__.MainTests) ... SHUTTER START
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_take_photo (__main__.MainTests) ... take_photo()
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
test_video_mode (__main__.MainTests) ... VIDEO MODE
HERO4 Black
HD4.02.03.00.00
Camera successfully connected!
ok
----------------------------------------------------------------------
Ran 9 tests in 85.749s
OK
一段测试代码,运行一下
代码语言:javascript复制from goprocam import GoProCamera
from goprocam import constants
import time
"""
间隔10s照片
"""
gpCam = GoProCamera.GoPro()
print(gpCam.take_photo(10))
在上图中,有一个ip地址。复制在浏览器打开。
直接点视频会下载,速度也是还可以但是4k的分辨率还是建议自己插卡传输
本文中粗浅的连接相机,跑了几个程序。并没有深入的来折腾。下一篇文章会使用高级功能。
比如,在树莓派上面的实时传输。人脸识别
Linux上的串流功能等~