Closed KevinEeckman closed 6 months ago
Hi,
The bit rate set by atomcam is 20 fps, which is the maximum bit rate supported by the Ingenic T31 SoC.
There are several commands to access the API to change the parameters of the video, but I am not sure if any of the commands are suitable for your purposes. Some of the parameters are not clear to me either.
You can login to atomcam via ssh and use the following command to change them.
# /scripts/cmd video <video_cmd> <param>
For example, to change the contrast
# /scripts/cmd video cont 200
You can find a list of video commands below. https://github.com/mnakada/atomcam_tools/blob/4568a2c5a7a6f0cf9155a627031ec906034e60ba/libcallback/video_callback.c#L321-L337
You can also extract video in HEVC via RTSP. The quality of the video seems to be a little better here.
Thanks, I'll have a look and report my findings if any
You can use the 'impdbg' tool to adjust video compression settings as well.
Hi,
You can use the 'impdbg' tool to adjust video compression settings as well.
How would I do this? This binary is present in /atom/system/bin/impdbg, but it doesn't run :
[root@atomcam-kitchen:bin]# pwd
/atom/system/bin
[root@atomcam-kitchen:bin]# ls -al impdbg
-rwxrwxr-x 1 avahi avahi 10352 Nov 12 2021 impdbg
[root@atomcam-kitchen:bin]# ./impdbg
-sh: ./impdbg: not found
The directory under /atom is where the original firmware is located and was built using uclibc. The atomcam_tools is built with glib, so you cannot execute the command as it is.
Please execute the command as follows.
# chroot /atom /system/bin/impdbg
Thanks to both of you, I've been able to make some progress.
Querying the various available image processors (showing only the high res h265 which I am interested in) :
# chroot /atom /system/bin/impdbg --enc_info
CHANNEL 2 1920x 1080 START H265 tf:1066431 df:75 encdur:56306621, encodingFrameCnt:1066356,endencodeFrameCnt=1066355,endrelaseFrameCnt=1066355,Fps:20.00,Bitrate:163.18
-------------------------------------------------
ch->index = 2
ch->releaseFrmNum = 0
ch->releaseFrmDen = 0
chnAttr->encAttr->eProfile = 16777217(0x1000001) offset:size = 0:4
chnAttr->encAttr->uLevel = 50(0x32) offset:size = 4:1
chnAttr->encAttr->uTier = 1(0x1) 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 = 600(0x258) offset:size = 48:4
chnAttr->rcAttr->CappedQuality->uMaxBitRate = 800(0x320) offset:size = 52:4
chnAttr->rcAttr->CappedQuality->iInitialQP = -1(0xffffffff) offset:size = 56:2
chnAttr->rcAttr->CappedQuality->iMinQP = 32(0x20) offset:size = 58:2
chnAttr->rcAttr->CappedQuality->iMaxQP = 51(0x33) offset:size = 60:2
chnAttr->rcAttr->CappedQuality->iIPDelta = -1(0xffffffff) offset:size = 62:2
chnAttr->rcAttr->CappedQuality->iPBDelta = -1(0xffffffff) 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
Then changing the target and max bitrates (those are the only obivous parameters I could spot) :
# chroot /atom /system/bin/impdbg --enc_rc_s 2:48:4:1200
# chroot /atom /system/bin/impdbg --enc_rc_s 2:52:4:1600
This seems to have some kind of effect, however it's night now in Japan and the image is very still, so I'll check again tomorrow.
Hi,
Has the image quality improved after the adjustment? I've heard that this setting has no effect (https://github.com/mnakada/atomcam_tools/issues/26) , so I'm curious about the results.
Hi, Yes, it does make a difference. Here is a screenshot comparison, taken from VLC :
Low bitrate :
chroot /atom /system/bin/impdbg --enc_rc_s 2:48:4:200
chroot /atom /system/bin/impdbg --enc_rc_s 2:52:4:300
High bitrate:
chroot /atom /system/bin/impdbg --enc_rc_s 2:48:4:1800
chroot /atom /system/bin/impdbg --enc_rc_s 2:52:4:2400
Do you know how to make this changes permanent across reboots of the camera ?
It looks very beautiful! Thank you.
Sorry, I don't know of any permanent settings. How about using rc.local?
Hi @mnakada,
Do you know how to make the camera settings above persistent across reboots ? Sorry, I am not very good at system management.
Hi @KevinEeckman,
The easiest way is to add the command you want to execute to /etc/init.d/S38atomcam after line 47, but if you make a mistake, it will not start. If it does not start, re-write the SD-Card again.
Thank you, I will try and let you know.
I've modified the /etc/init.d/S38atomcam
startup script by adding the following commands :
chroot /atom /system/bin/impdbg --enc_rc_s 2:48:4:1800
chroot /atom /system/bin/impdbg --enc_rc_s 2:52:4:2400
And it works fine. Thanks for the help, I am closing this issue.
Hi,
This is a very impressive job that you've made ! It makes these cameras very useful. Thanks for this.
Do you know if there's a way to increase the bitrate of the video feed (or to reduce the compression ?)
I am using an AtomCamSwing outside, and seeing small objects moving in the distance is difficult because of the pretty high compression making big pixel blocks