KonradIT / goprowifihack

Unofficial GoPro WiFi API Documentation - HTTP GET requests for commands, status, livestreaming and media query.
Apache License 2.0
2.11k stars 338 forks source link

MAX live preview unreliable audio stream #289

Closed sommercharles closed 1 year ago

sommercharles commented 1 year ago

Problem: MAX live preview unreliable audio stream

When following this note: https://github.com/KonradIT/goprowifihack/blob/master/MAX/Livestreaming.md and using ffplay -fflags nobuffer -f:v mpegts -probesize 8192 udp://:8554 with url -sS "http://10.5.5.9/gp/gpControl/execute?p1=gpStream&c1=restart" && while sleep 2.5; do echo '_GPHD_:0:0:2:0.000000'; done | nc -u -q 0 10.5.5.9 8554 to keep the stream alive, with the GoPro MAX in 360 video mode, the video streams just fine, but the audio stream is unreliable: it's either not decoded at all - not audible at all, or audible at the start of the stream but then gets dropped, and very rarely continuous throughout a 5 minutes stream - only on good days :]

Anyone experiencing the same behavior? Any clue on ffplay options that may improve audio reliability? Tried with gstreamer but to no avail, can't get any audio at all with gstreamer.

Details:

sommercharles commented 1 year ago

It seems ffmpeg and gstreamer decoders don't always recognize the audio stream. Using gstreamer, you can force the stream caps conf to set stream 0x1100 as audio, decode it and mux it in an FLV with the video, then stream that onto a local RTMP server (for instance). This gives a pretty decent audio+video stream:

gst-launch-1.0 -v udpsrc uri=udp://0.0.0.0:8554?overrun_nonfatal=1 \
  ! tsparse \
  ! tsdemux latency=100 name=demux \
  demux.video_0_1100 \
  ! capssetter caps='audio/mpeg, mpegversion=(int)4, stream-format=(string)adts' replace=true join=false \
  ! queue \
  ! aacparse \
  ! queue \
  ! flvmux streamable=true name=mux \
  ! queue \
  ! rtmpsink location="rtmp://127.0.0.1:1935/live/test live=1" \
  demux.video_0_1011 \
  ! "video/x-h264,profile=baseline,framerate=10/1" \
  ! queue \
  ! h264parse \
  ! queue \
  ! mux.