You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Using a Gopro Hero 8 from a macbook and calling for the gopro.livestream("start") runs, but only on low resolution. Changing the resolution using gopro.streamSettings() does not update the resolution.
I can change the camera FOV from the camera itself, and the resolution is either (480, 640) or (480, 848), depending on the camera's settings, but never higher than that.
Attached to this post, a testing script showing the changes I've made to try and edit the resolution.
To Reproduce
Steps to reproduce the behavior:
Connect via wifi to the gopro
Run the attached script
See that the resolution has not changed
Comment / uncomment the indicated lines of the script
See that the resolution has not changed
Desktop:
OS: macOS Big Sur
Version 11.2.3
Additional context
Note that it is not very resilient: I sometimes get ffmpeg errors forcing em to restart the system (missing headers...)
importcv2`
importsocketimportenumfromtimeimporttimeimportsubprocessfromgoprocamimportGoProCamera, constantsdeflocal_test():
sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
gopro=GoProCamera.GoPro(constants.gpcontrol) # pick one# gopro = GoProCamera.GoPro(constants.auth) # pick one (this one does not work: for gopro 4)# gopro = GoProCamera.GoPro() # pick onet=time()
gopro=change_gopro_params(gopro)
gopro=stream(gopro, "udp://10.5.5.9:8554", "low")
gopro=change_gopro_params(gopro)
cap=cv2.VideoCapture("udp://10.5.5.9:8554")
# width = 1920 # tried to add that, didn't work# height = 1080 # tried to add that, didn't work# cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) # tried to add that, didn't work# cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)# tried to add that, didn't workwhileTrue:
_, frame=cap.read()
print(frame.shape)
cv2.imshow("GoPro OpenCV", frame)
ifcv2.waitKey(1) &0xFF==ord('q'):
breakt=local_KeepAlive(sock, t)
cap.release()
cv2.destroyAllWindows()
defchange_gopro_params(gopro):
""" tried to edit params this way, commenting/adding lines. didn't work too """gopro.video_settings("1080p") # tried to add that, didn't work# gopro.gpControlSet(constants.Stream.IDR_INTERVAL, constants.Stream.IDRInterval.IDR4)# gopro.gpControlSet(constants.Stream.BIT_RATE, constants.Stream.BitRate.B250Kbps)# gopro.gpControlSet(constants.Stream.WINDOW_SIZE, constants.Stream.WindowSize.R720_1by2Subsample)# gopro.gpControlSet(constants.Stream.WINDOW_SIZE, constants.Stream.WindowSize.R720)# gopro.gpControlSet(constants.Photo.RESOLUTION, constants.Photo.Resolution.R12W)returngoprodefstream(gopro, addr, quality=""):
""" DISCLAIMER: this is an almost identical copy of the function gopro.stream() The only difference is that "KeepAlive" is commented, since it crashes the process. the function loc_KeepAlive does the same job, but was inspired from "examples/opencv_gopro/ffmpegless-preview.py" """gopro.livestream("start")
ifgopro.whichCam() ==constants.Camera.Interface.GPControl:
if"HERO4"ingopro.infoCamera("model_name"):
ifquality=="high":
gopro.streamSettings("2400000", "6")
elifquality=="medium":
gopro.streamSettings("1000000", "4")
elifquality=="low":
gopro.streamSettings("250000", "0")
else:
ifquality=="high":
gopro.streamSettings("4000000", "7")
elifquality=="medium":
gopro.streamSettings("1000000", "4")
elifquality=="low":
gopro.streamSettings("250000", "0")
# subprocess.Popen("ffmpeg -f mpegts -i udp://" +# ":8554 -b 800k -r 30 -f mpegts " + addr, shell=True)# gopro.KeepAlive()# elif gopro.whichCam() == constants.Camera.Interface.Auth:# subprocess.Popen("ffmpeg -i http://" +# "live/amba.m3u8 -f mpegts " + addr, shell=True)returngoprodeflocal_KeepAlive(sock, t):
""" Does the same job as gopro.KeepAlive, but was inspired from "examples/opencv_gopro/ffmpegless-preview.py" """iftime() -t>=2.5:
sock.sendto("_GPHD_:0:0:2:0.000000\n".encode(), ("10.5.5.9", 8554))
t=time()
returntif__name__=='__main__':
local_test()
The text was updated successfully, but these errors were encountered:
Describe the bug
Using a Gopro Hero 8 from a macbook and calling for the
gopro.livestream("start")
runs, but only on low resolution. Changing the resolution usinggopro.streamSettings()
does not update the resolution.I can change the camera FOV from the camera itself, and the resolution is either (480, 640) or (480, 848), depending on the camera's settings, but never higher than that.
Attached to this post, a testing script showing the changes I've made to try and edit the resolution.
To Reproduce
Steps to reproduce the behavior:
Desktop:
Additional context
Note that it is not very resilient: I sometimes get ffmpeg errors forcing em to restart the system (missing headers...)
The text was updated successfully, but these errors were encountered: