Giter VIP home page Giter VIP logo

goprostream's Introduction

GoProStream

Tools for handling/displaying GoPro HTTP/UDP stream. Available in Python.

Dependencies:

Python:

  • FFMPEG
  • urllib

Screenshots:

Compatible with:

  • HERO3
  • HERO3+
  • HERO4
  • HERO Session
  • HERO+ (incl. LCD)
  • HERO5 (needs testing)

Flags:

VERBOSE=False

Verbose flag for FFmpeg

RECORD=False

Sends a record command to the camera, camera must be in video mode!

STREAM=False

Creates a local stream via FFMPEG with minimized lag for use in OBS, camera must be in video mode!

SAVE=False

Save the gopro live feed to your machine

SAVE_FILENAME="goprofeed2"

The filename of the saved video feed

SAVE_FORMAT="mp4"

File format for saved video feed

SAVE_LOCATION="/home/konrad/Videos/"

Location for saved video feed (needs to be changed to your username and directory)

Further instructions:

https://medium.com/@konrad_it/how-to-stream-from-a-gopro-camera-f4a164150797

Credit

@SonOf8Bits

goprostream's People

Contributors

helmut-steiner avatar jesseproudman avatar konradit avatar neufeind avatar podfish avatar rd-o avatar vvvrrooomm avatar zutatensuppe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goprostream's Issues

Change Resolution?

Hi,

First, thanks for this repo. It helps me a lot. I have a question, how can I change the resolution on video streaming? I currently get resolution of 864x480. Thanks.

MacOS with an HERO 7 camera / HERO Session

I can't seem to be able to stream the video feed from the GoPro h7 to a macOS computer.

After editing the source code so that the H7 could go into the H4 branch, the program is able to find the info about the camera and starts the stream by launcing the ffplay command line, that only displays a blank screen. Various errors appears on the screen when using verbose.

Strange thing is that when I choose to save to a file, the file seem to work fine.

I tried launching on the term the ffplay command with similar results.

10.5.59/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart shows {"status":"0"}

VLC has a similar behaviour when trying I try to connect to udp://10.5.5.9:8554

Everything works fine on windows OS

I've also tried using your Python API (https://github.com/KonradIT/gopro-py-api) on macOS, which seems to be working fine, except for the streaming command that is reachable only with mpv (not on ffplay nor VLC)

MacOS is up to date (10.14.3), firewall is disabled

GoPro is up to date (01.61)

Thanks for your help on this issue

Hero5 Black hangs more than it works whenever I python3 *py.

The script fails more than it works, might be unstable wireless connectivity. The connection coming from the laptop might be too much for the cam? I don't know. I 've tried 2.4m to 10m, none of them works more than it fails.

Help please? I'm looking into it too.

Thanks!

HERP

Need a help please:

root@raspberrypi:/home/pi/Bureau/GoProStream-master# python3.6 GoProStream.py
branch HD4
HERO5 Session
HD5.03.02.51.00
UDP target IP: 10.5.5.9
UDP target port: 8554
message: GPHD:0:0:2:0.000000

Recording on camera: False
Recording locally: True
Recording stored in: /home/pi/Bureau/ZAKARIA/goprofeed3.ts
Note: Preview is not available when saving the stream.
Press ctrl+C to quit this application.

ffmpeg version 3.2.14-1deb9u1+rpt1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
configuration: --prefix=/usr --extra-version='1
deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100

Preview delays too much after first recording via the camera shutter button.

Preview delays too much after the first recording. Delay before first recording was fine - that's the live feed (RECORD and SAVE are FALSE), like that delay in the GoPro app (as said too in the docs. of the script). After the first recording via the shutter button on the camera, Preview lags/freezes and upon stopping recording via the camera shutter button, delay is doubled, even tripled.

Help please?

Thanks!

Feature request: to be able to preview and record like in the GoPro app.

I think that's really cool! I have quite some time on my hands. I don't code though. I only know very basic, and the most I know in is in Python. I'd gladly help though. Hopefully I can help to make this process/feature request faster to reality! :D

Sorry for sounding naive, but really I think this feature is neat! I've tried doing this by having two versions of the script: one that does preview and the other records. Doesn't work, because there should only be one instance of the script running at anytime.

Can't tell if it's streaming properly - possibly ffplay issue

Hi Konrad,
I'm trying to run this script as a proof of concept but only getting partial success. Both FFMPEG and FFPLAY seem to be properly installed but I'm not getting the preview window.
Any ideas?
BTW: Sorry if this is not thebest medium to ask you about his since I don't think there's anythig wrong with your code

projects/GoProStream $ python ./GoProStream.py3
HERO5 Black
HD5.02.02.51.00
UDP target IP: 10.5.5.9
UDP target port: 8554
message: _GPHD_:0:0:2:0.000000

Recording on camera: False
Recording locally: True
Recording stored in: /tmp/goprofeed3.ts
Note: Preview is not available when saving the stream.
Press ctrl+C to quit this application.

ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mpegts @ 0x1df4420] Could not find codec parameters for stream 2 (Unknown: none ([128][0][0][0] / 0x0080)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'udp://:8554':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709), 864x480 [SAR 1:1 DAR 9:5], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 139 kb/s
    Stream #0:2[0x200]: Unknown: none ([128][0][0][0] / 0x0080)
File '/tmp/goprofeed3.ts' already exists. Overwrite ? [y/N] y
Output #0, mpegts, to '/tmp/goprofeed3.ts':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuvj420p, 864x480 [SAR 1:1 DAR 9:5], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 139 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x1e63d60] Non-monotonous DTS in output stream 0:0; previous: 3003, current: 3003; changing to 3004. This may result in incorrect timestamps in the output file.
frame=  497 fps= 58 q=-1.0 Lsize=    6130kB time=00:00:17.53 bitrate=2863.8kbits/s    
video:5335kB audio:276kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.253855%

no module named http

I am getting this error while running the python script on command prompt. The code was working fine before, I don't know what happened. This is what command prompt is printing when I run the command:

Traceback (most recent call last): File "GoProStream.py", line 32, in <module> import http ImportError: No module named http

Any help?

How do I run Record and Preview from anywhere in the terminal?

I could've set it already to $PATH if it was only an executable, like downloading youtube-dl from it's official website. But it comes with a README and a .rb. I think I may have to do some compilation and then make it an executable - removing the extension too. Then only I think I can set a $PATH for it and be able to call it from anywhere in the terminal. I think that's really awesome! :D

Looking forward to you guys' replies! :D

Stream quality, delay and artifacting

Hello, I am struggling with very poor stream quality on hero 6

With max bitrate and resolution from
this page it is still looking just like low res preview rather than actual stream

Audio is sightly delayed, but video is even way worse.

Video also has significant artifacting, with errors in ffmpeg stream,
[h264 @ 0x7f5bfc06e540] error while decoding MB 60 20, bytestream 7140 [h264 @ 0x7f5bfc06e540] concealing 1989 DC, 1989 AC, 1989 MV errors in P frame [h264 @ 0x7f5bfc0185c0] left block unavailable for requested intra4x4 mode -1 [h264 @ 0x7f5bfc0185c0] error while decoding MB 0 42, bytestream 501 [h264 @ 0x7f5bfc0185c0] concealing 289 DC, 289 AC, 289 MV errors in P frame [h264 @ 0x7f5bfc1ff800] left block unavailable for requested intra mode [h264 @ 0x7f5bfc1ff800] error while decoding MB 0 44, bytestream 692 [h264 @ 0x7f5bfc1ff800] concealing 129 DC, 129 AC, 129 MV errors in P frame [h264 @ 0x7f5bfc21bd00] error while decoding MB 64 43, bytestream -6 [h264 @ 0x7f5bfc21bd00] concealing 145 DC, 145 AC, 145 MV errors in P frame [h264 @ 0x7f5bfc2385c0] concealing 1896 DC, 1896 AC, 1896 MV errors in P frame [h264 @ 0x7f5bfc254e80] cabac decode of qscale diff failed at 48 8
I tried both 5ghz and 2.4 and different bitrate settings and it seems the same.

I tried same camera with smartphone, which works much better, so I guess ffplay is causing the issue.

Is everyone else experiencing this, or am I missing some obvious setting?? This makes gopro completely useless for streaming.

Not working for GoPro 6

Your python script work very well with the gopro 4. But now I try it with a gopro 6 black with the latest firmware.

Your script write only some logs but did not start the stream:

branch HD4
HERO6 Black
HD6.01.02.01.00
UDP target IP: 10.5.5.9
UDP target port: 8554
message: _GPHD_:0:0:2:0.000000

Recording on camera: False

When I try to execute the ffplay command direct, than I only get a "nan".
ffplay -fflags nobuffer -f:v mpegts -probesize 8192 udp://:8554
ffplay version N-90061-gfb580731c1 Copyright (c) 2003-2018 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth libavutil 56. 7.101 / 56. 7.101 libavcodec 58. 11.101 / 58. 11.101 libavformat 58. 9.100 / 58. 9.100 libavdevice 58. 1.100 / 58. 1.100 libavfilter 7. 12.100 / 7. 12.100 libswscale 5. 0.101 / 5. 0.101 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100

nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0

All other commands like switching the mode or capture a photo work very well by send the appropriated HTTTP get command.
When I'm getting the http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart than I'm getting the correct response {"status":"0" }

Is there a way to get more informations from ffplay?

Do you know what I'm doing wrong? Or is there a problem with the latest gopro firmware.

GOPro HERO9 video is corrupted

Seems this library doesn't support HERO9 yet
What I did is change the open live stream code from

urlopen("http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart").read()

to

urlopen("http://10.5.5.9/gp/gpControl/execute?p1=gpStream&c1=restart").read()

and add or "HD9" to if "HD4" in response...

Then it starts working! But the video is half corrupted.

image

Any tips/reason on how to solve this? 🙏

GoPro goes to sleep?

I am using GoPro Hero5 Black

After about 3-5 minutes it seems that the connection from the go pro side drops?

Any ideas?

doesn't work with gopro hero 3+

Traceback (most recent call last):
File "/usr/lib/python3.6/http/client.py", line 283, in _read_status
status = int(status)
ValueError: invalid literal for int() with base 10: 'ÿûAllow:'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "GoProStream.py", line 118, in
gopro_live()
File "GoProStream.py", line 47, in gopro_live
response_raw = urllib.request.urlopen('http://10.5.5.9/gp/gpControl').read().decode('utf-8')
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.6/urllib/request.py", line 1321, in do_open
r = h.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 287, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: HTTP/1.1 ÿûAllow: GET

i had this error when i run the python script, instead with a gopro hero4 it works

gopro hero7

Hello,
I'm trying to use the script with a goprohero7:

"info": {
    "model_number": 30,
    "model_name": "HERO7 Black",
    "firmware_version": "HD7.01.01.70.00",
    "serial_number": "",
    "board_type": "0x05",
    "ap_mac": "",
    "ap_ssid": "",
    "ap_has_default_credentials": "0",
    "git_sha1": "b29c80591af6b628f0debffdccd8def70e8a696b",
    "capabilities": "16",
    "lens_count": "1",
    "update_required": "0"
  }

I've changed in the script the ip adress of my laptop wich is 10.5.5.101 instead of 10.5.5.100
When I run the sudo python3 GoProStream.py, it runs ok:

sudo python3 GoProStream.py 
branch HD4
HERO7 Black
HD7.01.01.70.00
UDP target IP: 10.5.5.9
UDP target port: 8554
message: _GPHD_:0:0:2:0.000000

Recording on camera: False
Press ctrl+C to quit this application.

But nothing comes out from nethier ffplay nor vlc
traces in wireshark are showing a lot of udp traffic

I've compared the results of your gpControl-HERO7Black.json with one i've generated.
Put appart the
"version": 3.0,
There are very few differences,

Do you have an idea of why I can't make this work ?
Thanks a lot

how to stream on hero 5 black?

result

I cloned the Github code and executed it. And this pic is the result.
be unresponsive The preview window won't open. I tried it with a virtual box on ubuntu, but it's the same.
I didn't have a Wireless LANCard, so I connected Wi-Fi with my cell phone and connected it to my computer with usb tethering. Can this be a problem?
I had no problem controlling the camera by connecting to usb tethering.

I'll wait for a good answer. Thank you.

Problem with HERO+ sometimes it works ...

Hello very good script ;-) but i got a problem.

I works a few seconds only if i put rec ON on my Gopro hero + and i stop recording. After stop recording it’s here that ffplay give the stream on my computer. And after few seconds the stream STOP. Thank you for your help…
Sometimes it works and sometimes it don't work with the probleme ...
Thank you

Does not save

Great library! I can get it to stream to my Mac using ffplay, but it will not save to any file path I specify using ffmpeg. Any ideas?

Problem with live stream in Hero 8 black go pro

Hi, first off thank you for such wonderful programs.It really made our life easier to start exploring gopro.
I am trying to get live stream GoPro hero 8 black in jetson nano board running Ubuntu 18.04 LTS. I tried goprostream.py but could get the live feed. It throws “urllib.error.HTTPError: HTTP Error 500: Internal Server Error”.

Any help will be helpful and appreciated.

How do I make the preview screen into full screen?

The full screen I'm able to do isn't entirely full screen. I want a full screen that's like the one in YouTube (you double-click a YouTube video and then it goes fullscreen). I film skateboarding and I believe this full screen capability that I ask for is very useful. Of course not only in skateboarding, but in most GoPro shoots/uses.

Thanks!

Ffmpeg doesn't open the preview window

I've tried the script under Linux successfully, however under windows (with all the prerequisites satisfied) the script runs, detects the gopro and start "the stream" but no live window opens automatically like under Linux.

No errors are shown in the console so I don't know how to help debug the issue at the moment.

I've also tried to run the script from the shell with administrator privileges.

shell

GoPro Hero 6 5GHz WiFi

As you may (or not) know, the GoPro Hero 6 is region locked for its 5GHz Wifi. Is there are chance we could override these settings via its API? I found some strings regarding the API possibilities, but I couldn't make use of them.

Do you have time to take a look at this?

Also, should we expect autoexec.sh for the Hero 6? I found C:\autoexec.sh string in the fw, but I couldn't get it to execute. Maybe I'm doing something wrong, but both echo and reboot commands didn't work.

Thank you for your efforts!

GOPRO Hero3 silver - Win10 OK- Jetson Nano NOK

Hi every one,
I followed the following steps and would need some insight on the reason of the issue :
1- Tested the code on my laptop (Win10) and it works fine --> OK
2- Tested it on my NVIDIA Jetson nano with (Ubuntu 18.04.4-bionic) but i get the following error.
--> http 101 - gone

~/Documents/Python/00_scripts$ python3 goprostream.py
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1264, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1310, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1259, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1038, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 976, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 948, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "goprostream.py", line 162, in <module>
    gopro_live()
  File "goprostream.py", line 65, in gopro_live
    response_raw = urlopen('http://10.5.5.9/gp/gpControl').read().decode('utf-8')
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1353, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>

3- I try again on Win10 and it gives the same error
4- I stop wifi emision on the gopro and restart it
5- I try on Win10 it works
From here i thought that maybe it got "paired" with the Win 10 computer somehow and tried again on the Jetson nano --> Not working.

What could I check to get rig of this http 101 error ? I tried modifying my wifi settings on the nano but it was of no help.

Bonus question : is the 2-3s lag normal ? Can it be improved ?

Thank a lot anyway for this great code.

Bye !

FFplay

I am having a problem when running the stream. When running it i get the error "'ffplay' is not recognized as an internal or external program or batch file"

I have checked my environmental variables over and the FFMPEG installation. Cannot figure out how to fix this.

I am new to this so hope someone can help me.
image

Gopro hero 7 udp stream

Hi, I use gstreamer to stream udp live stream from my gopro5. It works well but resolution is low for my use case (resolution 868x480). I would like to know if I can do the same with gopro 7 (gopro 7 streams in udp ? (resolution ???)
Thanks in advance
David

Is this still working with current FW?

I have made some changes to the code, so I am able to start the udp stream from my HERO3+ with the latest firmware. But ffmpeg is not receiving any data, even though I see UDP packets flowing in Wireshark.

Has anybody experienced simillar issue? Is the UDP data being encrypted now?

Can't make this work - HERO4 Silver - Win10

It seems like great work, thank you guys for that.

Dependencies installed, command runs forever, no error output, but no livestream window pops...

Any idea what I could try / fix?

Firmware is: HD4.01.05.00.00

I tried the solution inthe last message there:
#3
It won't work

Trigger "LIVE" function

I'm not sure if this is maybe out of scope of this repo, but as it is about GoProStreaming, I thought to give it a go. The GoPro ("Quik") App supports "live". This creates an RTMP live stream, it even supports streaming to a custom server. I tested it and it works great. It does not need the phone to stream, it just needs the phone to start the stream. Is it possible to invoke this without the app somehow?

These API endpoints might be useful:

But how do I start the stream?

Update: I tried using packet capture on android to see what happens, but the app(quik) just says that the connection failed. Weird. This seems to happen if any VPN service (like PacketCapture or Netguard) is activ.

gopro hero 5 with RaspberryPi3

Need a help pleaseeee : when the run the file GoProStream.py
, i have that problem :
1
2

it's our end-of-year project, with the constraint of the temp

not connecting to hero 5 session (working on hero 4 session)

Hi,

with hero 4 session everything works. trying to connect to hero 5 session i get this error:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1239, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 938, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
TimeoutError: [Errno 60] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "GoProStream.py", line 162, in
gopro_live()
File "GoProStream.py", line 65, in gopro_live
response_raw = urlopen('http://10.5.5.9/gp/gpControl').read().decode('utf-8')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 60] Operation timed out>

Any idea what i can do?

Import to OpenCV

Hi ,
Thanks to the python script, I am able to stream Gopro video with some acceptable lag. I was wondering if you could guide me on how I can convert frames shown by ffplay in subprocess.Popen into Opencv structure for further analysis.
Thanks
Best,

Can't Connect GoPro Hero4 Session UDP stream on laptop

After looking at this thread: KonradIT/goprowifihack#47, I tried to get a stream running by using the GoPro app to get the UDP stream up and running. However, I still can't seem to connect to the UDP stream via VLC or ffplay.

Steps to reproduce issue:

  1. Executed http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart and received {status: "0"} as a response.
  2. Started a preview session using the GoPro App.
  3. Executed http://10.5.5.9/gp/gpControl/status and received a response,
{"status":{
 "1":1,"2":0,"3":0,"4":0,"6":0,"8":0,"9":1,"10":0,"11":0,"13":0,"14":0,"15":0,"16":0,"17":1,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"26":0,"27":0,"28":0,"29":"","30":"GoProSession","31":2,"32":0,"33":0,"34":8921,"35":9840,"36":0,"37":0,"38":0,"39":0,"40":"%12%07%08%0B%17%16","41":0,"42":0,"43":0,"44":0,"45":0,"46":1,"47":0,"48":0,"49":0,"54":31997001728,"55":1,"56":4,"57":4104,"58":0,"59":0,"60":500,"61":2,"62":0,"63":0,"64":17842},
 "settings":{"1":0,"2":9,"3":8,"4":0,"5":2,"6":1,"7":0,"8":1,"9":0,"10":1,"11":0,"12":0,"13":1,"14":4,"15":4,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":2,"30":2,"31":0,"32":10,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"49":0,"50":0,"51":1,"52":0,"53":0,"54":0,"55":1,"56":0,"57":0,"58":0,"59":0,"60":8,"61":1,"62":700000,"63":1,"64":2,"68":0,"69":0,"70":1,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0}}

This confirmed that both my phone and my laptop are connected to the GoPro. I can even see the stream show up on my phone.

  1. I tried connect to the UDP stream via VLC by using the "Open network stream" option and using the following addresses udp://:8554, udp://10.5.5.9:8554 and udp://10.5.5.100:8554, but the stream wouldn't show up.

  2. I tried connecting via,
    ffplay -loglevel panic -fflags nobuffer -f:v mpegts -probesize 8192 udp://10.5.5.9:8554
    ffplay -loglevel panic -fflags nobuffer -f:v mpegts -probesize 8192 udp://10.5.5.100:8554
    ffplay -loglevel panic -fflags nobuffer -f:v mpegts -probesize 8192 udp://:8554
    But to no avail.

  3. I tried using the GoProStream.py script. However, I get the following output

branch HD4
HERO4 Session
HX1.01.02.00
('UDP target IP:', '10.5.5.9')
('UDP target port:', 8554)
('message:', '_GPHD_:0:0:2:0.000000\n')
Recording on camera: False
Press ctrl+C to quit this application.

with the stream never showing up.

  1. I tried redirecting the stream to localhost:1000 as suggested somewhere in the issues as well. As a result, I installed goprocam and ran the following script
from goprocam import GoProCamera
from goprocam import constants
gopro = GoProCamera.GoPro()
gopro.stream("udp://127.0.0.1:10000")

and this is the response I got

HERO4 Session
HX1.01.02.00
Camera successfully connected!
{"status":"0"}


ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100

The output suggest that everything seems to be working fine, however the stream doesn't show up. Ctrl+C'ing out of the script resulted in these failure messages showing up

Traceback (most recent call last):
  File "Test.py", line 4, in <module>
    gopro.stream("udp://127.0.0.1:10000")
  File "/home/kshitij/.local/lib/python3.5/site-packages/goprocam/GoProCamera.py", line 864, in stream
    self.KeepAlive()
  File "/home/kshitij/.local/lib/python3.5/site-packages/goprocam/GoProCamera.py", line 67, in KeepAlive
    time.sleep(2500/1000)
KeyboardInterrupt
[mpegts @ 0x10a5580] Could not detect TS packet size, defaulting to non-FEC/DVHS
udp://10.5.5.9:8554: could not find codec parameters

Here is the info about my GoPro Hero4 Session

{"info":{"model_number":16,"model_name":"HERO4 Session","firmware_version":"HX1.01.02.00","serial_number":"C3141325722464","board_type":"0x07","ap_mac":"F4DD9E23FD95","ap_ssid":"GoProSession","ap_has_default_credentials":"0"}}

Here's a screenshot about (5) and (6), if it helps: https://imgur.com/a/aK7BsdU

ffmpeg throws error ''udp://10.5.5.100:8554': Invalid argument' with SAVE flag enabled

Using GoPro Hero6. I pulled the repo earlier today, all I changed was the SAVE flag (I want to record and save to my Windows 10 PC, not stream), and the save destination. The rest of the code is consistent with the repo. I'm a novice so my apoligies ig the answer is obvious. The streaming works with SAVEing turned off strangely enough. Here's my output:

branch HD4
HERO6 Black
HD6.01.02.01.00
UDP target IP: 10.5.5.9
UDP target port: 8554
message: GPHD:0:0:2:0.000000

Recording on camera: False
Recording locally: True
Recording stored in: C:/Users/USER/Videos/GoPro/goprofeed3.ts
Note: Preview is not available when saving the stream.
Press ctrl+C to quit this application.

ffmpeg version N-94576-g1965161ef6 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 31.101 / 58. 31.101
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
'udp://10.5.5.100:8554': Invalid argument

GoPro app replacement

I don't know if this is the place to suggest ideas, but a GoPro app replacement would be nice, very nice! I'm up to help. How do I start to be able to help make this a reality? Haha! It's funny! But really, I think this is neat! And if it helps that there be another person to work on this, I have quite some time on my hands. I'm down to help!

I have the GoPro 5 Black. And so I'm looking forward that the replacement will work with my camera.

import error on module request - streaming session 4 by the py script

Opening the gopro Session 4 by the app is possible streaming by ffmpeg in udp or rtp port.
Without this operation the cam doesn't respond on url command ... and doesn't stream....
Running the GoProStreaming.py, after connection of wifi, file error "on line 17 " appear...
ImportError: no module named request

Any suggestion? thanks!!
immagine

python and ruby version doesn't work

require '../gopro-rb-api/lib/GoPro'
require '../gopro-rb-api/lib/constants.rb'

Files do not exist. where can i get . Also, when trying to run the python version, i get urllib errors even though it's installed..

python GoProStream.py
Traceback (most recent call last):
File "GoProStream.py", line 17, in
import urllib.request
ImportError: No module named request

root@HP_ENCODER:~/GoProStream# dpkg -l urllib
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================-=================-=================-=====================================================
ii python-urllib3 1.7.1-1ubuntu4 all HTTP library with thread-safe connection pooling for
ii python3-urllib3 1.7.1-1ubuntu4 all HTTP library with thread-safe connection pooling for

GoPro HERO5 & Raspberry Pi [mp2 @ 0xd24b00] Header missing Error

Screenshot 2020-01-20 at 13 54 14
I'm currently trying to stream my GoPro HERO5 video to a Raspberry Pi in mp4 format but all I get is a repeated Error:

[mp2 @ 0xd24b00] Header missing
Error while decoding stream #0:0: Invalid data found when processing input

What could this be caused by? Everything I did was set the Save parameter to True, change the target directory and set format to mp4.

Any ideas?

Please make a tutorial that anyone can understand

I have my gopro and want to use it as webcam using wifi, So I want to thank you for making such a good tool..
But I don't know anything about python, ffmpeg, urllib..
I installed Python through searching, But I have no idea how to install ffmpeg and urllib.
Especially for ffmpeg. There are so many versions of it on the internet that I can't choose correct one to use.
I will research and learn more about python, but I think It would be great if there is a tutorial that even monkey can understand.
Yes, That's right! I request the tutorial because I'm stupid. Thank you :D

PSA: UDP stream mpegts formatting

In investigating some decoding issues encountered when using live preview on a HERO5, I came to realize an important point I haven't seen documented elsewhere, please forgive me if this is duplicate information. I suspect few issues posted to this repo are suffering from this behavior:

UDP payloads received from the device live preview feature are not well-formed mpegts

...at least without some manipulation of the payload. Depending on the demuxer / container parser implementation downstream, this may disrupt bitstream decoding.

For this analysis I used:

  • GoPro HERO5
  • 2.7K Res, 30FPS
  • Triggering live preview with combination of http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart and UDP keepalive messages, as defined in this repo and https://github.com/KonradIT/goprowifihack (thanks for all this work, btw -- hats off to you, @KonradIT!)

Observe:

  1. mpegts defines a multiplexed bitstream segmented into (at most) 188-byte packets, each starting with the sync byte 0x47
  2. In my testing, I observe received UDP payload size of 1328 bytes per datagram/packet. I suspect this could change with different video configurations. This is not enough to indicate a problem, but in inspecting the bitstream, we see that
  3. The sync byte for the first TS packet(s) in every UDP payload is at a fixed offset from the first byte in the (UDP) packet.

It appears the device is prepending each UDP payload with a 12-byte header. I don't recognize the header format (doesn't seem to be RTP or SRT), but it appears there is at least a sequence number (for the UDP packet sequence, not the TS packets) and a seqno overflow counter packed in to the header. If you strip away the first 12 bytes of each received UDP packet and pass it to a TS parser, many the warnings previously emitted by ffmpeg/ffplay (eg ffplay udp://:8554) and gstreamer about the input bitstream go away. Additionally, when decoding the AVC bitstream, there's a significant reduction in visible artifacts. I suspect those artifacts and errors are introduced when the fixed header seqno rolls over the TS sync byte magic number 0x47; this would be enough to confuse most demuxers I have worked with.

I'll follow up if I figure out anything else that's interesting/relevant, but wanted to get this out there. I haven't figured out a good way to integrate a solution to this repository, but some form of packet preprocessing before passing to the TS demuxer might go a long way to improve the live stream experience. I would suggest to spawn a separate child to bind local UDP port 8554, strip the first 12 bytes of each received payload from the camera, and replay the result to a loopback port which your player/parser can bind to.

Input/Output Error from FFMPEG

I am facing an issue with connecting the GoPro Hero 7 using Raspberry Pi (running Raspian) using the GoProStream.py, in the STREAM mode after 1-2 minutes (randomly) the FFMPEG stops with an error as below -

udp://10.5.5.100:8554: Input/Output error 

If I don't use Stream=True, and only play using FFPlay then it keeps playing for an hour without any issue. I was sending it to a network PC's UDP port earlier but when I switched it to a file output that failed as well.

Any inputs or advise will be much appreciated

P.S - Thanks for finding this hack and building the ecosystem around it.

problem in GoProStream.py ?

If I want to works on my ubuntu 18.04 (WSL), I need to remove a ':' on line 110 of GoProStream.py

before: "... ffmpeg -i 'udp://:10.5.5.100:8554' ..."
after : "... ffmpeg -i 'udp://10.5.5.100:8554' ..."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.