From 8ec1be166670b5867d000ede9f5958283e8158d6 Mon Sep 17 00:00:00 2001 From: Alfonso Gamboa Date: Mon, 23 May 2022 18:41:21 -0700 Subject: [PATCH] add fps to rtsp, revise run_mmc.sh for v2 --- README.md | 3 +++ SD_ROOT/wz_mini/run_mmc.sh | 26 ++++++++++++++++++++++---- v2_install/fw_tool.sh | 5 ++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9c87efc..2428075 100644 --- a/README.md +++ b/README.md @@ -221,12 +221,14 @@ RTSP_PORT="8554" RTSP_HI_RES_ENABLED="true" RTSP_HI_RES_ENABLE_AUDIO="true" +RTSP_HI_RES_FPS="20" RTSP_HI_RES_MAX_BITRATE="2048" RTSP_HI_RES_TARGET_BITRATE="1024" RTSP_HI_RES_ENC_PARAMETER="2" RTSP_LOW_RES_ENABLED="false" RTSP_LOW_RES_ENABLE_AUDIO="false" +RTSP_LOW_RES_FPS="" RTSP_LOW_RES_MAX_BITRATE="" RTSP_LOW_RES_TARGET_BITRATE="" RTSP_LOW_RES_ENC_PARAMETER="" @@ -258,6 +260,7 @@ WEB_CAM_FPS_RATE="25" ## Latest Updates +* 05-22-22: added fps variable for rtsp server, thanks @claudobahn. * 05-22-22: Update wz_mini scripts and libraries to support v2 camera. experimental. * 05-20-22: updated to latest libcallback including mp4write, bug fixes: usb direct mac addr, usb webcam mode bad variable. * 05-18-22: Added PC Web Camera functionality, changed RTSP server, when you use enable more than one stream, they share the port and use different paths. diff --git a/SD_ROOT/wz_mini/run_mmc.sh b/SD_ROOT/wz_mini/run_mmc.sh index 823ee52..7d12ed8 100755 --- a/SD_ROOT/wz_mini/run_mmc.sh +++ b/SD_ROOT/wz_mini/run_mmc.sh @@ -43,12 +43,14 @@ RTSP_PORT="8554" RTSP_HI_RES_ENABLED="false" RTSP_HI_RES_ENABLE_AUDIO="false" +RTSP_HI_RES_FPS="" RTSP_HI_RES_MAX_BITRATE="" RTSP_HI_RES_TARGET_BITRATE="" RTSP_HI_RES_ENC_PARAMETER="" RTSP_LOW_RES_ENABLED="false" RTSP_LOW_RES_ENABLE_AUDIO="false" +RTSP_LOW_RES_FPS="" RTSP_LOW_RES_MAX_BITRATE="" RTSP_LOW_RES_TARGET_BITRATE="" RTSP_LOW_RES_ENC_PARAMETER="" @@ -194,7 +196,7 @@ first_run_check wait_sdroot wait_wlan -if [[ -d /etc/hotplug ]]; then +if cat /params/config/.product_config | grep WYZEC1-JZ; then V2="true" KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14_v2" else @@ -390,7 +392,7 @@ fi if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then - if [[ -d /etc/hotplug ]]; then + if [[ "$V2" == "true" ]]; then HI_VIDEO_DEV="/dev/video6" else HI_VIDEO_DEV="/dev/video1" @@ -442,6 +444,14 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then fi fi + if [[ "$RTSP_HI_RES_FPS" != "" ]]; then + if [[ "$V2" == "true" ]]; then + watch -n10 -t "/system/bin/impdbg --enc_rc_s 0:8:4:$RTSP_HI_RES_FPS" > /dev/null 2>&1 & + else + watch -n10 -t "/system/bin/impdbg --enc_rc_s 0:80:4:$RTSP_HI_RES_FPS" > /dev/null 2>&1 & + fi + fi + else echo "rtsp disabled" @@ -449,8 +459,8 @@ fi if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then - - if [[ -d /etc/hotplug ]]; then + + if [[ "$V2" == "true" ]]; then LOW_VIDEO_DEV="/dev/video7" else LOW_VIDEO_DEV="/dev/video2" @@ -503,6 +513,14 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then fi fi + if [[ "$RTSP_LOW_RES_FPS" != "" ]]; then + if [[ "$V2" == "true" ]]; then + watch -n10 -t "/system/bin/impdbg --enc_rc_s 1:8:4:$RTSP_LOW_RES_FPS" > /dev/null 2>&1 & + else + watch -n10 -t "/system/bin/impdbg --enc_rc_s 1:80:4:$RTSP_LOW_RES_FPS" > /dev/null 2>&1 & + fi + fi + else echo "rtsp disabled" diff --git a/v2_install/fw_tool.sh b/v2_install/fw_tool.sh index 71c5108..e6ead5c 100755 --- a/v2_install/fw_tool.sh +++ b/v2_install/fw_tool.sh @@ -18,6 +18,7 @@ if [ "$ACTION" = "unpack" ]; then dd if=${DEMO_IN} of=$OUT_DIR/rootfs.bin skip=$ROOTFS_OFFSET count=$(($DRIVER_OFFSET-$ROOTFS_OFFSET)) bs=1 md5sum $OUT_DIR/rootfs.bin + dd if=${DEMO_IN} of=$OUT_DIR/driver.bin skip=$DRIVER_OFFSET count=$(($APPFS_OFFSET-$DRIVER_OFFSET)) bs=1 md5sum $OUT_DIR/driver.bin @@ -28,8 +29,10 @@ if [ "$ACTION" = "unpack" ]; then elif [ "$ACTION" = "pack" ]; then TMP_DIR=$2 DEMO_OUT=$3 -# need to pad kernel is its smaller than the stock kernel size, 2097152 bytes + + #need to pad kernel is its smaller than the stock kernel size, 2097152 bytes dd if=/dev/zero of=$TMP_DIR/kernel.bin bs=1 count=1 seek=2097151 + cat $TMP_DIR/kernel.bin $TMP_DIR/rootfs.bin $TMP_DIR/driver.bin $TMP_DIR/appfs.bin > $TMP_DIR/flash.bin mkimage -A MIPS -O linux -T firmware -C none -a 0 -e 0 -n jz_fw -d $TMP_DIR/flash.bin $DEMO_OUT