gtxaspec / wz_mini_hacks

wz camera mods... make your camera better.
1.29k stars 109 forks source link

RTSP can't lower fps #398

Open foureight84 opened 1 year ago

foureight84 commented 1 year ago

I have the following settings for RTSP:

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="2048"
RTSP_HI_RES_ENC_PARAMETER="2"

RTSP_LOW_RES_ENABLED="true"
RTSP_LOW_RES_ENABLE_AUDIO="false"
RTSP_LOW_RES_FPS="10"
RTSP_LOW_RES_MAX_BITRATE=""
RTSP_LOW_RES_TARGET_BITRATE=""
RTSP_LOW_RES_ENC_PARAMETER="2"

When I view both live streams in VLC and inspect the media info, I notice that both streams show 20fps when the lower res is set to 10fps. Shouldn't the low res stream get capped at 10fps?

foureight84 commented 1 year ago

It looks like low-res fps and hi-res fps are tied together. I updated the hi res to use 30fps and kept low res at 10fps but vlc stream info shows that the low res is now at 30fps as well.

gtxaspec commented 1 year ago

try the latest release. fps is set differently now.

gtxaspec commented 1 year ago

looks like theres a bug, i'll look into it

gtxaspec commented 1 year ago

fixed in upcoming release.

gtxaspec commented 1 year ago

fixed in https://github.com/gtxaspec/wz_mini_hacks/commit/86b4f3842941b8bb8c193250d457ab6deed9ac64

gtxaspec commented 1 year ago

Paste the output of 'impdbg --enc_info' please

Scooter3232 commented 1 year ago

impdbg --enc_info

[root@WCV3:~]# impdbg --enc_info
GROUP 0
    CHANNEL 0    1920x 1080     START H264 tf:403        df:9          encdur:20113, encodingFrameCnt:394,endencodeFrameCnt=393,endrelaseFrameCnt=392,Fps:20.00,Bitrate:313.96
-------------------------------------------------
ch->index = 0
ch->releaseFrmNum = 0
ch->releaseFrmDen = 0
chnAttr->encAttr->eProfile = 77(0x4d) offset:size = 0:4
chnAttr->encAttr->uLevel = 41(0x29) offset:size = 4:1
chnAttr->encAttr->uTier = 0(0x0) offset:size = 5:1
chnAttr->encAttr->uWidth = 1920(0x780) offset:size = 6:2
chnAttr->encAttr->uHeight = 1080(0x438) offset:size = 8:2
chnAttr->encAttr->ePicFormat = 392(0x188) offset:size = 12:4
chnAttr->encAttr->eEncOptions = 294952(0x48028) offset:size = 16:4
chnAttr->encAttr->eEncTools = 156(0x9c) offset:size = 20:4
chnAttr->rcAttr->rcMode = 8(0x8) offset:size = 44:4
chnAttr->rcAttr->CappedQuality->uTargetBitRate = 360(0x168) offset:size = 48:4
chnAttr->rcAttr->CappedQuality->uMaxBitRate = 480(0x1e0) offset:size = 52:4
chnAttr->rcAttr->CappedQuality->iInitialQP = -1(0xffffffff) offset:size = 56:2
chnAttr->rcAttr->CappedQuality->iMinQP = 23(0x17) offset:size = 58:2
chnAttr->rcAttr->CappedQuality->iMaxQP = 51(0x33) offset:size = 60:2
chnAttr->rcAttr->CappedQuality->iIPDelta = 3(0x3) offset:size = 62:2
chnAttr->rcAttr->CappedQuality->iPBDelta = 3(0x3) offset:size = 64:2
chnAttr->rcAttr->CappedQuality->eRcOptions = 1(0x1) offset:size = 68:4
chnAttr->rcAttr->CappedQuality->uMaxPictureSize = 1920(0x780) offset:size = 72:4
chnAttr->rcAttr->CappedQuality->uMaxPSNR = 48(0x30) offset:size = 76:2
chnAttr->rcAttr->outFrmRate->frmRateNum = 20(0x14) offset:size = 80:4
chnAttr->rcAttr->outFrmRate->frmRateDen = 1(0x1) offset:size = 84:4
chnAttr->gopAttr->uGopCtrlMode = 2(0x2) offset:size = 88:4
chnAttr->gopAttr->uGopLength = 40(0x28) offset:size = 92:2
chnAttr->gopAttr->uNotifyUserLTInter = 0(0x0) offset:size = 94:1
chnAttr->gopAttr->uMaxSameSenceCnt = 1(0x1) offset:size = 96:4
chnAttr->gopAttr->bEnableLT = 0(0x0) offset:size = 100:1
chnAttr->gopAttr->uFreqLT = 0(0x0) offset:size = 104:4
chnAttr->gopAttr->bLTRC = 0(0x0) offset:size = 108:1
    CHANNEL 4    1920x 1080      STOP JPEG tf:0          df:0          encdur:20261, encodingFrameCnt:0,endencodeFrameCnt=0,endrelaseFrameCnt=0,Fps:0.00,Bitrate:0.00
-------------------------------------------------
ch->index = 4
ch->releaseFrmNum = 0
ch->releaseFrmDen = 0
chnAttr->encAttr->eProfile = 67108864(0x4000000) offset:size = 0:4
chnAttr->encAttr->uLevel = 0(0x0) offset:size = 4:1
chnAttr->encAttr->uTier = 0(0x0) offset:size = 5:1
chnAttr->encAttr->uWidth = 1920(0x780) offset:size = 6:2
chnAttr->encAttr->uHeight = 1080(0x438) offset:size = 8:2
chnAttr->encAttr->ePicFormat = 392(0x188) offset:size = 12:4
chnAttr->encAttr->eEncOptions = 294952(0x48028) offset:size = 16:4
chnAttr->encAttr->eEncTools = 156(0x9c) offset:size = 20:4
chnAttr->rcAttr->rcMode = 0(0x0) offset:size = 44:4
chnAttr->rcAttr->FixQP->iInitialQP = 32(0x20) offset:size = 48:2
chnAttr->rcAttr->outFrmRate->frmRateNum = 20(0x14) offset:size = 80:4
chnAttr->rcAttr->outFrmRate->frmRateDen = 1(0x1) offset:size = 84:4
chnAttr->gopAttr->uGopCtrlMode = 2(0x2) offset:size = 88:4
chnAttr->gopAttr->uGopLength = 40(0x28) offset:size = 92:2
chnAttr->gopAttr->uNotifyUserLTInter = 0(0x0) offset:size = 94:1
chnAttr->gopAttr->uMaxSameSenceCnt = 1(0x1) offset:size = 96:4
chnAttr->gopAttr->bEnableLT = 0(0x0) offset:size = 100:1
chnAttr->gopAttr->uFreqLT = 0(0x0) offset:size = 104:4
chnAttr->gopAttr->bLTRC = 0(0x0) offset:size = 108:1
GROUP 1
    CHANNEL 1     640x  360     START H264 tf:389        df:2          encdur:20060, encodingFrameCnt:387,endencodeFrameCnt=386,endrelaseFrameCnt=385,Fps:20.00,Bitrate:111.13
-------------------------------------------------
ch->index = 1
ch->releaseFrmNum = 0
ch->releaseFrmDen = 0
chnAttr->encAttr->eProfile = 77(0x4d) offset:size = 0:4
chnAttr->encAttr->uLevel = 50(0x32) offset:size = 4:1
chnAttr->encAttr->uTier = 0(0x0) offset:size = 5:1
chnAttr->encAttr->uWidth = 640(0x280) offset:size = 6:2
chnAttr->encAttr->uHeight = 360(0x168) offset:size = 8:2
chnAttr->encAttr->ePicFormat = 392(0x188) offset:size = 12:4
chnAttr->encAttr->eEncOptions = 294952(0x48028) offset:size = 16:4
chnAttr->encAttr->eEncTools = 156(0x9c) offset:size = 20:4
chnAttr->rcAttr->rcMode = 8(0x8) offset:size = 44:4
chnAttr->rcAttr->CappedQuality->uTargetBitRate = 180(0xb4) offset:size = 48:4
chnAttr->rcAttr->CappedQuality->uMaxBitRate = 240(0xf0) offset:size = 52:4
chnAttr->rcAttr->CappedQuality->iInitialQP = -1(0xffffffff) offset:size = 56:2
chnAttr->rcAttr->CappedQuality->iMinQP = 23(0x17) offset:size = 58:2
chnAttr->rcAttr->CappedQuality->iMaxQP = 51(0x33) offset:size = 60:2
chnAttr->rcAttr->CappedQuality->iIPDelta = 3(0x3) offset:size = 62:2
chnAttr->rcAttr->CappedQuality->iPBDelta = 3(0x3) offset:size = 64:2
chnAttr->rcAttr->CappedQuality->eRcOptions = 1(0x1) offset:size = 68:4
chnAttr->rcAttr->CappedQuality->uMaxPictureSize = 640(0x280) offset:size = 72:4
chnAttr->rcAttr->CappedQuality->uMaxPSNR = 48(0x30) offset:size = 76:2
chnAttr->rcAttr->outFrmRate->frmRateNum = 20(0x14) offset:size = 80:4
chnAttr->rcAttr->outFrmRate->frmRateDen = 1(0x1) offset:size = 84:4
chnAttr->gopAttr->uGopCtrlMode = 2(0x2) offset:size = 88:4
chnAttr->gopAttr->uGopLength = 40(0x28) offset:size = 92:2
chnAttr->gopAttr->uNotifyUserLTInter = 0(0x0) offset:size = 94:1
chnAttr->gopAttr->uMaxSameSenceCnt = 1(0x1) offset:size = 96:4
chnAttr->gopAttr->bEnableLT = 0(0x0) offset:size = 100:1
chnAttr->gopAttr->uFreqLT = 0(0x0) offset:size = 104:4
chnAttr->gopAttr->bLTRC = 0(0x0) offset:size = 108:1
    CHANNEL 5     640x  360      STOP JPEG tf:19         df:0          encdur:13317, encodingFrameCnt:19,endencodeFrameCnt=19,endrelaseFrameCnt=19,Fps:1.39,Bitrate:176.43
-------------------------------------------------
ch->index = 5
ch->releaseFrmNum = 0
ch->releaseFrmDen = 0
chnAttr->encAttr->eProfile = 67108864(0x4000000) offset:size = 0:4
chnAttr->encAttr->uLevel = 0(0x0) offset:size = 4:1
chnAttr->encAttr->uTier = 0(0x0) offset:size = 5:1
chnAttr->encAttr->uWidth = 640(0x280) offset:size = 6:2
chnAttr->encAttr->uHeight = 360(0x168) offset:size = 8:2
chnAttr->encAttr->ePicFormat = 392(0x188) offset:size = 12:4
chnAttr->encAttr->eEncOptions = 294952(0x48028) offset:size = 16:4
chnAttr->encAttr->eEncTools = 156(0x9c) offset:size = 20:4
chnAttr->rcAttr->rcMode = 0(0x0) offset:size = 44:4
chnAttr->rcAttr->FixQP->iInitialQP = 32(0x20) offset:size = 48:2
chnAttr->rcAttr->outFrmRate->frmRateNum = 20(0x14) offset:size = 80:4
chnAttr->rcAttr->outFrmRate->frmRateDen = 1(0x1) offset:size = 84:4
chnAttr->gopAttr->uGopCtrlMode = 2(0x2) offset:size = 88:4
chnAttr->gopAttr->uGopLength = 40(0x28) offset:size = 92:2
chnAttr->gopAttr->uNotifyUserLTInter = 0(0x0) offset:size = 94:1
chnAttr->gopAttr->uMaxSameSenceCnt = 1(0x1) offset:size = 96:4
chnAttr->gopAttr->bEnableLT = 0(0x0) offset:size = 100:1
chnAttr->gopAttr->uFreqLT = 0(0x0) offset:size = 104:4
chnAttr->gopAttr->bLTRC = 0(0x0) offset:size = 108:1
gtxaspec commented 1 year ago

One more, 'ps auxww'

Scooter3232 commented 1 year ago

ps auxww'

You got it!

[root@WCV3:~]# ps auxww
PID   USER     TIME  COMMAND
    1 root      0:00 {wz_init.sh} /bin/sh /opt/wz_mini/etc/init.d/wz_init.sh
    2 root      0:00 [kthreadd]
    3 root      0:00 [ksoftirqd/0]
    5 root      0:00 [kworker/0:0H]
    6 root      0:00 [kworker/u2:0]
    7 root      0:00 [rcu_preempt]
    8 root      0:00 [rcu_bh]
    9 root      0:00 [rcu_sched]
   10 root      0:00 [watchdog/0]
   11 root      0:00 [khelper]
   12 root      0:00 [kdevtmpfs]
   13 root      0:00 [writeback]
   14 root      0:00 [bioset]
   15 root      0:00 [kblockd]
   16 root      0:00 [khubd]
   17 root      0:00 [kworker/0:1]
   18 root      0:00 [cfg80211]
   19 root      0:00 [rpciod]
   20 root      0:01 [kworker/0:2]
   21 root      0:00 [kswapd0]
   22 root      0:00 [fsnotify_mark]
   23 root      0:00 [nfsiod]
   24 root      0:00 [crypto]
   39 root      0:00 [kworker/u2:2]
   40 root      0:00 [deferwq]
   45 root      0:00 [mmcqd/0]
   48 root      0:00 [kworker/0:1H]
  139 root      0:00 /opt/wz_mini/bin/dropbear -R -s -g
  160 root      0:00 {linuxrc} init
  173 root      0:00 [jffs2_gcd_mtd6]
  202 root      0:00 /opt/wz_mini/bin/busybox inotifyd /opt/wz_mini/usr/bin/watch_up.sh /tmp n
  213 root      0:00 {S18fps} /bin/sh /opt/wz_mini/etc/rc.d/S18fps start
  225 root      0:00 /sbin/getty -L console 115200 vt100
  232 root      0:00 [irq/37-isp-m0]
  234 root      0:00 [irq/38-isp-w02]
  291 root      0:00 [phy0-atbm_wq]
  292 root      0:00 [phy0-atbm_bh]
  293 root      0:00 [phy0-sdio_tx]
  294 root      0:02 [phy0-sdio_rx]
  295 root      0:00 [ksdioirqd/mmc1]
  353 root      0:00 dmon --stderr-redir --max-respawns 20 --environ LD_PRELOAD=libsetunbuf.so /sbin/syslogd -C2048 -n -S -- dslog --priority DEBUG --facility USER syslogd
  356 root      0:00 /sbin/syslogd -C2048 -n -S
  357 root      0:00 dslog --priority DEBUG --facility USER syslogd
  359 root      0:00 dmon --stderr-redir --max-respawns 20 --environ LD_PRELOAD=libsetunbuf.so /system/bin/assis -- dslog --priority DEBUG --facility USER assis
  361 root      0:00 dmon --stderr-redir --max-respawns 20 --environ LD_PRELOAD=libsetunbuf.so /system/bin/hl_client -- dslog --priority DEBUG --facility USER hl_client
  363 root      0:00 /system/bin/assis
  364 root      0:00 dslog --priority DEBUG --facility USER assis
  365 root      0:00 dmon --stderr-redir --max-respawns 20 --environ LD_PRELOAD=libsetunbuf.so /system/bin/sinker -- dslog --priority DEBUG --facility USER sinker
  367 root      0:01 /system/bin/hl_client
  368 root      0:00 dslog --priority DEBUG --facility USER hl_client
  369 root      0:00 dmon --stderr-redir --max-respawns 0 --environ LD_PRELOAD=libsetunbuf.so /opt/wz_mini/usr/bin/iCamera -- dslog --priority DEBUG --facility USER iCamera
  371 root      0:00 /system/bin/sinker
  372 root      0:00 dslog --priority DEBUG --facility USER sinker
  373 root      0:00 {iCamera} /bin/sh /opt/wz_mini/usr/bin/iCamera
  374 root      0:00 dslog --priority DEBUG --facility USER iCamera
  377 root      1:56 /system/bin/iCamera
  380 root      0:00 dmon --stderr-redir --max-respawns -1 --environ LD_PRELOAD=libsetunbuf.so /system/bin/timesync -- dslog --priority DEBUG --facility USER timesync
  382 root      0:00 /system/bin/timesync
  383 root      0:00 dslog --priority DEBUG --facility USER timesync
  384 root      0:00 dmon --stderr-redir --max-respawns 0 --environ LD_PRELOAD=libsetunbuf.so /system/bin/audiocardprocess -- dslog --priority DEBUG --facility USER audiocardprocess
  385 root      0:00 /system/bin/audiocardprocess
  386 root      0:00 dslog --priority DEBUG --facility USER audiocardprocess
  442 root      0:00 {sysMonitor.sh} /bin/sh /system/bin/sysMonitor.sh
  484 root      0:00 httpd -p 80 -h /opt/wz_mini/www -r Identify yourself: -c /opt/wz_mini/etc/httpd.conf
  506 root      0:00 /system/bin/impdbg --enc_rc_s 0:80:4:5
  511 root      0:00 /opt/wz_mini/bin/bash /opt/wz_mini/usr/bin/imp_monitor.sh --daemon-loop
  516 root      0:12 [isp_fw_process]
  518 root      0:00 impdbg --enc_info
  624 root      0:00 wpa_supplicant -D nl80211 -i wlan0 -c /tmp/wpa_supplicant.conf -B
  684 root      0:00 udhcpc -i wlan0 -H WyzeCam -p /var/run/udhcpc.pid -b
  866 root      0:00 /opt/wz_mini/bin/dropbear -R -s -g
  867 root      0:00 -sh
  933 root      0:05 /opt/wz_mini/bin/v4l2rtspserver -F0 -U admin:14eliarome -P 8554 /dev/video1
 1024 root      0:00 /tmp/edgeai/wyzeedgeai_cam_v3_prod /tmp/edgeai/aiparams.ini /tmp/edgeai/model_params.ini
 1208 root      0:01 ./kvsWebrtcClientMaster config.json
 1538 root      0:00 /system/bin/kvs_stream
17197 root      0:00 sleep 2
17198 root      0:00 ps auxww
gtxaspec commented 1 year ago

Are you on the very latest release? https://github.com/gtxaspec/wz_mini_hacks/commit/86b4f3842941b8bb8c193250d457ab6deed9ac64 should have fixed this

gtxaspec commented 1 year ago

Strange. I'll test again...

Scooter3232 commented 10 months ago

I don't know that it qualifies as a "fix", but I've found a way around this. Two things I did, but I don't believe the 2nd is necessary, it just makes me happy that it is the correct number ;) I was able to get the desired FPS with just the first change and verified with both mpv and VLC.

  1. edit /configs/.user_config and add an fps line
[root@wyze-cam-1:~]# more /configs/.user_config 

[SETTING]
bitRate=120
MASwitch=1
timezone=-7
fps=5
  1. Edit /opt/wz_mini/etc/network.d/S15v4l2rtspserver

And manually change the -F0 to -F5

LD_LIBRARY_PATH=/opt/wz_mini/lib LD_PRELOAD=/system/lib/libsetunbuf.so /opt/wz_mini/bin/v4l2rtspserver $AUDIO_CH $AUDIO_FMT -F5 -U "$RTSP_LOGIN":"$RTSP_PASSWORD" -P "$RTSP_PORT" $DEVICE1 $DEVICE2 > $RTSP.log 2>&1 &
amandamana commented 8 months ago

I'm experiencing glitches too. I got one camera to work after setting both the VIDEO_0_FPS and VIDEO_1_FPS (even though a single stream was enabled). But then that exact SD card didn't work when moved to an identical v3 cam. I gave up and hacked the fps line into /configs/.user_config