KonradIT / GoProStream

Tools for handling/displaying GoPro HTTP/UDP stream (Python/Ruby)
374 stars 100 forks source link

Can't Connect GoPro Hero4 Session UDP stream on laptop #30

Open Kshitij-Khode opened 6 years ago

Kshitij-Khode commented 6 years ago

After looking at this thread: https://github.com/KonradIT/goprowifihack/issues/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.**

4. 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.

5. 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.

6. 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.

7. 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 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
nathanstep55 commented 6 years ago

Hello,

I'd just like to say that I am currently having the same issue as you. I got it to work on one of my PCs using the gopro_keepalive script a few months back, but as of now I only have gotten it to work on the ffmpegless script. Now, I've tried it on another PC and I am experiencing the exact same issues as you. I tried reverting my Python version and goprocam version to the working ones, but they do not work on the other computer. Attempting to execute streaming results in status 0 consistently. I will let you know if I find a solution.

For reference: The working machine used Windows 10 and the non-working had Windows Server 2016. I attempted to use versions 2.0.6 and 2.0.1 of goprocam. The GoPro is running the latest firmware (HX1.01.02.00). I used a nightly build of ffmpeg for the issues above, but the working machine (which ffmpeg didn't work on the second time) uses an earlier nightly build from 2017 or so.

KonradIT commented 6 years ago

Hi. Try adding a @ symbol to 10.5.5.9, I think we got it solved that way in another issue.

Kshitij-Khode commented 6 years ago

Due to time crunch constraints, I simply moved away from my Linux VM and ran things on an alt-boot installation of Linux. This fixed the issue for me.

nathanstep55 commented 6 years ago

Where exactly should I be adding an @? I tried in the UDP address and it still didn't work (since the stream isn't even starting). Trying to sock.sendto with the @ symbol does not work either. Doing so in Chrome to enter the URLs makes no difference, still status 0.

KonradIT commented 6 years ago

I should've been more specific, sorry, in line 94 replace

udp://10.5.5.100:8554

with

udp://@10.5.5.100:8554

I'll add it to the code if it works.

nathanstep55 commented 6 years ago

In the GoProStream.py script it never reaches that part of the code, since it's trying to get status 31 from the GoPro (which is returning status 0).

When I modified the gopro-py-api code, which loads ffmpeg, it still didn't change the results.

SirPolaris commented 5 years ago

This "bug" still exists. I got nailed as well after trying to connect VLC to watch the stream. Minutes before that, the stream was running (albeit, unknown if it was actually working)

As suspected it was a hang in the GoPro. Full powerdown, restart fixed it. Perhaps VLC keeps the connection open and barrs the GoPro from starting another video stream or something.

MundMBo commented 4 years ago

I made the same experience today. I tried to stream from my GoPro Hero 4 Black: The status code stays 0 and the stream never starts :/

I also tried to use ffplay manually and once some data were transmitted, but ffplay was reporting not readable headers and corrupt packages. In the end not any image could be displayed ...

Any ideas how to fix that?

Marky0 commented 3 years ago

I had the same problem with HERO7 black on both windows and linux. For whatever reason I could not get VLC to connect, always getting an error code "unable to open the MRL...." But achieved success with ffplay with the following line

ffplay udp://@10.5.5.9:8554 -fflags nobuffer

whilst executing

goproCamera = GoProCamera.GoPro() goproCamera.livestream("start") #execute this every ~ten seconds to maintain UDP stream

ffplay does occasionally still report unreadable headers and corrupt packages, but the video is still displayed OK.