mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-09 15:08:21 +00:00
go2rtc: add initial support
This commit is contained in:
parent
34712eb4ee
commit
f0c7c4e092
BIN
SD_ROOT/wz_mini/bin/go2rtc_linux_mipsel
Executable file
BIN
SD_ROOT/wz_mini/bin/go2rtc_linux_mipsel
Executable file
Binary file not shown.
18
SD_ROOT/wz_mini/etc/go2rtc.yml
Normal file
18
SD_ROOT/wz_mini/etc/go2rtc.yml
Normal file
@ -0,0 +1,18 @@
|
||||
log:
|
||||
level: info # default level
|
||||
api: trace
|
||||
exec: debug
|
||||
ngrok: info
|
||||
rtsp: warn
|
||||
streams: error
|
||||
webrtc: fatal
|
||||
ffmpeg:
|
||||
bin: /opt/wz_mini/bin/ffmpeg
|
||||
streams:
|
||||
1080p:
|
||||
- exec:ffmpeg -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 100 -analyzeduration 50 -probesize 50 -pix_fmt yuv420p -r 30 -i /dev/video1 -flags +global_header -movflags +empty_moov+default_base_moof+frag_keyframe -framerate 30 -video_size 1920x1080 -pix_fmt yuv420p -c:v copy -copyts -rtsp_transport tcp -f rtsp {output}
|
||||
# - exec:ffmpeg -hide_banner -f alsa -ac 1 -i default -c:a libopus -ac:a 2 -c:v copy -f rtsp {output}
|
||||
|
||||
360p:
|
||||
- exec:ffmpeg -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 100 -analyzeduration 50 -probesize 50 -pix_fmt yuv420p -r 30 -i /dev/video2 -framerate 30 -video_size 640x360 -pix_fmt yuv420p -c:v copy -copyts -rtsp_transport tcp -f rtsp {output}
|
||||
# - exec:ffmpeg -hide_banner -f alsa -ac 1 -i default -c:a libopus -ac:a 2 -c:v copy -f rtsp {output}
|
@ -40,8 +40,8 @@ case "$1" in
|
||||
modprobe cp210x
|
||||
fi
|
||||
|
||||
if ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]) && ! [[ -e /tmp/dbgflag ]]; then
|
||||
if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
|
||||
if ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$GO2RTC_LOW_RES_ENABLED" == "true" ]]|| [[ "$GO2RTC_HI_RES_ENABLED" == "true" ]]) && ! [[ -e /tmp/dbgflag ]]; then
|
||||
if ([[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$GO2RTC_LOW_RES_ENABLED" == "true" ]]) && ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$GO2RTC_HI_RES_ENABLED" == "true" ]]); then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "Load video loopback driver at video6 video7"
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6,7
|
||||
@ -49,7 +49,7 @@ case "$1" in
|
||||
echo "Load video loopback driver at video1 video2"
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1,2
|
||||
fi
|
||||
elif [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
|
||||
elif ([[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$GO2RTC_LOW_RES_ENABLED" == "true" ]]); then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "Load video loopback driver at video7"
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=7
|
||||
@ -57,7 +57,7 @@ case "$1" in
|
||||
echo "Load video loopback driver at video2"
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=2
|
||||
fi
|
||||
elif [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
|
||||
elif ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$GO2RTC_HI_RES_ENABLED" == "true" ]]); then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "Load video loopback driver at video6"
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6
|
||||
@ -68,7 +68,6 @@ case "$1" in
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$ENABLE_NFSv4" == "true" ]]; then
|
||||
insmod $KMOD_PATH/kernel/lib/oid_registry.ko
|
||||
insmod $KMOD_PATH/kernel/net/dns_resolver/dns_resolver.ko
|
||||
|
117
SD_ROOT/wz_mini/etc/network.d/S17go2rtc
Normal file
117
SD_ROOT/wz_mini/etc/network.d/S17go2rtc
Normal file
@ -0,0 +1,117 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides:
|
||||
# Short-Description: Start go2rtc Server
|
||||
# Description: Provide Streaming Video over IP
|
||||
### END INIT INFO
|
||||
|
||||
. /opt/wz_mini/wz_mini.conf
|
||||
|
||||
GO2RTC=/opt/wz_mini/log/go2rtc
|
||||
if [[ -e $GO2RTC.log || -L $GO2RTC.log ]] ; then
|
||||
i=0
|
||||
while [[ -e $GO2RTC.log.$i || -L $GO2RTC.log.$i ]] ; do
|
||||
let i++
|
||||
done
|
||||
mv $GO2RTC.log $GO2RTC.log.$i
|
||||
GO2RTC=$GO2RTC
|
||||
fi
|
||||
touch -- "$GO2RTC".log
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
||||
echo "#####$(basename "$0")#####"
|
||||
|
||||
if [[ "$GO2RTC_SERVER_ENABLED" == "true" ]]; then
|
||||
echo "go2rtc enabled"
|
||||
else
|
||||
echo "go2rtc disabled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$GO2RTC_HI_RES_ENABLED" == "true" ]]; then
|
||||
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
HI_VIDEO_DEV="/dev/video6"
|
||||
else
|
||||
HI_VIDEO_DEV="/dev/video1"
|
||||
fi
|
||||
|
||||
echo "Enable video ch 0"
|
||||
/opt/wz_mini/bin/cmd video 0 on > /dev/null
|
||||
|
||||
if [[ "$GO2RTC_HI_RES_ENABLE_AUDIO" == "true" ]]; then
|
||||
echo "Enable audio ch 0"
|
||||
/opt/wz_mini/bin/cmd audio 0 on > /dev/null
|
||||
AUDIO_CH="-C 1"
|
||||
AUDIO_FMT="-a S16_LE"
|
||||
DEVICE1="$HI_VIDEO_DEV,hw:0,0"
|
||||
else
|
||||
DEVICE1="$HI_VIDEO_DEV"
|
||||
echo "go2rtc hi_res audio disabled"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "go2rtc hi_res disabled"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$GO2RTC_LOW_RES_ENABLED" == "true" ]]; then
|
||||
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
LOW_VIDEO_DEV="/dev/video7"
|
||||
else
|
||||
LOW_VIDEO_DEV="/dev/video2"
|
||||
fi
|
||||
|
||||
echo "Enable video ch 1"
|
||||
/opt/wz_mini/bin/cmd video 1 on > /dev/null
|
||||
|
||||
if [[ "$GO2RTC_LOW_RES_ENABLE_AUDIO" == "true" ]]; then
|
||||
echo "Enable video ch 1"
|
||||
/opt/wz_mini/bin/cmd audio 1 on > /dev/null
|
||||
AUDIO_CH="-C 1"
|
||||
AUDIO_FMT="-a S16_LE"
|
||||
DEVICE2="$LOW_VIDEO_DEV,hw:2,0"
|
||||
else
|
||||
DEVICE2="$LOW_VIDEO_DEV"
|
||||
echo "go2rtc low_res audio disabled"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "go2rtc low_res disabled"
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$GO2RTC_LOW_RES_ENABLED" == "true" ]] || [[ "$GO2RTC_HI_RES_ENABLED" == "true" ]]; then
|
||||
echo "delay go2rtc for iCamera"
|
||||
#This delay is required. Sometimes, if you start the go2rtc server too soon, live view will break on the app.
|
||||
sleep 5
|
||||
|
||||
/opt/wz_mini/bin/go2rtc_linux_mipsel -config /opt/wz_mini/etc/go2rtc.yml > $GO2RTC.log 2>&1 &
|
||||
|
||||
fi
|
||||
|
||||
sync;echo 3 > /proc/sys/vm/drop_caches
|
||||
;;
|
||||
stop)
|
||||
pkill go2rtc_linux_mipsel
|
||||
cmd video 0 off
|
||||
cmd audio 0 off
|
||||
cmd video 1 off
|
||||
cmd audio 1 off
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -74,6 +74,12 @@ VIDEO_1_TARGET_BITRATE=""
|
||||
VIDEO_1_ENC_PARAMETER=""
|
||||
VIDEO_1_FPS=""
|
||||
|
||||
GO2RTC_SERVER_ENABLED="false"
|
||||
GO2RTC_HI_RES_ENABLED="false"
|
||||
GO2RTC_HI_RES_ENABLE_AUDIO="false"
|
||||
GO2RTC_LOW_RES_ENABLED="false"
|
||||
GO2RTC_LOW_RES_ENABLE_AUDIO="false"
|
||||
|
||||
#####RTMP STREAMING#####
|
||||
#### REQUIRES RTSP ####
|
||||
### AND RTSP AUDIO ###
|
||||
|
Loading…
Reference in New Issue
Block a user