ifconfig shows positive values of RX packets/bytes for camera though.
It might be something with marking connection as ESTABLISHED.
To remedy this I tried the script below before ffmpeg
gopro_device=`ip -4 --oneline link | grep -v "state DOWN" | grep -v "LOOPBACK" | grep -v "NO-CARRIER" | cut -f2 -d":" | tail -1`
# will succeed when goPro IP is last on the list: ip -4 --oneline link ...
gopro_ip=`ip -4 addr show dev $gopro_device | grep -Po '(?<=inet )[\d.]+'`
gopro_interface_ip=`echo "$gopro_ip" | awk -F"." '{print $1"."$2"."$3".51"}'`
# tcpdump
# GoPro has to be turned on to get its port, tcpdump will wait for the start of webcam mode: curl -s ${gopro_interface_ip}/gp/gpWebcam/START?res=480
gopro_port=`tcpdump -ni $gopro_device -c 1 dst port 8554 2>/dev/null | grep -o '51.[0-9]*' | grep -o '.[0-9]*$' | cut -c2-`
echo -n "gopro" | nc -w0 -u $gopro_interface_ip $gopro_port -s $gopro_ip -p 8554 >/dev/null
and voilà :-) ffmpeg works. Lets call it a "tcpdump script".
Wrong IP
It might be something with VPN connection when you turn on your GoPro before VPN resulting GoPro's IP being not last.
For that case
ip -4 --oneline link | grep -v "state DOWN" | grep -v "LOOPBACK" | grep -v "NO-CARRIER" | cut -f2 -d":" | tail -1
gives wrong name of device (~287 line of code).
Script will not work when -p | --device-pattern is not used.
Rotation issue
It might happen that you prefer portrait but on e.g. Zoom preview you are 'landscaped' :wink:
In ffmpeg one can add a rotation by slight change of format and add a metadata:
It might not be the best solutions because upper and bottom part of video are cropped, but I didn't find anything better yet.
Nice to have's
Exit webcam
One can quit webcam mode of GoPro by: curl -s ${GOPRO_INTERFACE_IP}/gp/gpWebcam/EXIT
If it does not work, then /gopro/webcam/exit is another option to check.
"WebCam on demand"
ffmpeg consumes a lot of CPU, so option to finish it would be a better choice.
ffmpeg without -nostdin enables to press q for exit.
With this option one can prepare for meeting
Thanks for your script. I would still struggle with other issues if there was no your gopro repo.
My camera is GoPro HERO10.
When ffmpeg is executed it gets freezed on this:
ifconfig
shows positive values ofRX packets/bytes
for camera though.It might be something with marking connection as
ESTABLISHED
. To remedy this I tried the script below beforeffmpeg
and voilà :-) ffmpeg works. Lets call it a "
tcpdump
script".Wrong IP
It might be something with VPN connection when you turn on your GoPro before VPN resulting GoPro's IP being not last.
For that case
gives wrong name of device (~287 line of code).
Script will not work when
-p | --device-pattern
is not used.Rotation issue
It might happen that you prefer portrait but on e.g. Zoom preview you are 'landscaped' :wink:
In ffmpeg one can add a rotation by slight change of format and add a metadata:
It might not be the best solutions because upper and bottom part of video are cropped, but I didn't find anything better yet.
Nice to have's
Exit webcam
One can quit webcam mode of GoPro by:
curl -s ${GOPRO_INTERFACE_IP}/gp/gpWebcam/EXIT
If it does not work, then
/gopro/webcam/exit
is another option to check."WebCam on demand"
ffmpeg consumes a lot of CPU, so option to finish it would be a better choice.
ffmpeg without
-nostdin
enables to pressq
for exit. With this option one can prepare for meetingcurl -s ${GOPRO_INTERFACE_IP}/gp/gpWebcam/START?res=${GOPRO_RESOLUTION}
tcpdump
script"ffmpeg
q
inffmpeg
curl -s $GOPRO_INTERFACE_IP/gp/gpWebcam/STOP
curl -s ${GOPRO_INTERFACE_IP}/gp/gpWebcam/EXIT
Is there any video meeting soon? Go back to 1. step.
There are some minor challenges still, but I would still struggle with "webcam on linux user-story" if there was no your repo. Thanks for this. :)