OpenIPC / firmware

Alternative IP Camera firmware from an open community
https://openipc.org
MIT License
1.2k stars 232 forks source link

41.25 fps from sensor sc223a (sc5239s) #1324

Closed RoboSchmied closed 5 months ago

RoboSchmied commented 6 months ago

You can get 41.24 fps on gk7205v210 with sensor sc5239s (which openipc labels sc223a), not only 30 fps.

Set fps: 45 in /etc/majestic.yaml and Isp_FrameRate=45 in /etc/sensors/sc223a_i2c_1080p.ini. majestic output:

05:26:22  <       majestic> [    puts]                               linear mode
[Func]:cmos_fps_set [Line]:288 [Info]:Not support Fps: 45.000000
05:26:22  <       majestic> [    puts]                               === Smart SC223A_1080P_30FPS_10BIT_LINE_Init_OK!===
05:26:22  <       majestic> [     sdk] log_venc_chn@1256             H.264 1920x1080 45fps 6000Kbit  90 GOP

Majestic says it can Not support Fps: 45, but it is running faster than only with fps: 30 settings.

So should this be the new default for sc223a, even if the value you set (45 fps) is not exactly what you will get from sensor (41.24 fps) ?

The video looks more fluently. The frames are unique. No double frames are produced.

Can someone owning a sc223a please confirm the frame rate after changing the 2 lines? Thank you.

jimsmt commented 6 months ago

https://smartsens.oss-cn-beijing.aliyuncs.com/web/products/SC223A_V3.0.pdf The sensor's physic limit is 30fps, I doubt that you really got 41.24 fps

RoboSchmied commented 6 months ago

Thank you for the info. Actually I bought a sensor advertised as sc5239s (4MP) which OpenIPC recognizes as sc223a (2MP). And with the driver of sensor sc223a it can bring 41.24 fps.

OK, so I think the sensor distinction has to be corrected before changing any values for the wrong sensor.

themactep commented 6 months ago

Do you have a datasheet on your sensor? Read its hardware ID to confirm the model.

themactep commented 6 months ago

SC5239s would be a 5MP sensor, not 4MP. First digit denotes the resolution. If you were sold it as a 4MP, that should raise question if it is a legitimate hardware and if it is a 2MP SC223a instead.

RoboSchmied commented 6 months ago

If you were sold it as a 4MP, that should raise question if it is a legitimate hardware and if it is a 2MP SC223a instead

I bought the sensor here: aliexpress. It is advertised as 4MP. The stock firmware offers the 4MP mode and it brings 4MP.

It is definitely not only 2 MP.

themactep commented 6 months ago

Very reassuring. You know what? I have a bridge to sell you.

themactep commented 6 months ago

https://www.smartsenstech.com/en/mproducts_list?products_label=sc

RoboSchmied commented 6 months ago

Very reassuring.

Sorry, I would not doubt your expertise.

I have a bridge to sell you.

How much? ;)

https://www.smartsenstech.com/en/mproducts_list?products_label=sc

Thank you. I was unaware of the sensor labeling.

Do you have a datasheet on your sensor?

No.

Read its hardware ID to confirm the model.

Ok, I will try now.

RoboSchmied commented 6 months ago

Read its hardware ID to confirm the model.

How do I get the hardware ID? Here is the ipctool output:

root@openipc-gk7205v210:~# ipctool 
---
chip:
  vendor: Goke
  model: 7205V210
  id: 24662c1050a059e3
board:
  vendor: OpenIPC
  version: 2.4.01.19
ethernet:
  mac: "da:3c:1a:69:b2:bc"
  u-mdio-phyaddr: 1
  phy-id: 0x20669906
  d-mdio-phyaddr: 0
rom:
- type: nor
  block: 64K
  partitions:
    - name: boot
      size: 0x40000
      sha1: deca8aff
    - name: env
      size: 0x10000
      sha1: 6b5302d6
      contains:
        - name: uboot-env
          offset: 0x0
    - name: kernel
      size: 0x200000
      sha1: 381b79bd
    - name: rootfs
      size: 0x500000
      sha1: b323395a
    - name: rootfs_data
      size: 0xb0000
      path: /overlay,jffs2,rw
  size: 8M
  addr-mode: 3-byte
ram:
  total: 64M
  media: 24M
firmware:
  kernel: "4.9.37 (Fri Jan 19 23:35:21 CET 2024)"
  toolchain: buildroot-gcc-12.3.0
  main-app: wfb_tx
sensors:
- vendor: SmartSens
  model: SC223A
  control:
    bus: 0
    type: i2c
    addr: 0x60
  data:
    type: MIPI
    input-data-type: DATA_TYPE_RAW_10BIT
    lane-id:
      - 0
      - 1
    image: 1920x1080
  clock: 37.125MHz

Here some dmesg output:

<0>FUNC:parse_sensor_clock line:125  SNS: is [sc223a]!
<0>FUNC:parse_sensor_bus_type line:88  SNS is [sc223a]  !
<0>==== online_flag=0, cmos_yuv_flag=0, sensor=sc223a, chip=gk7205v200, board=demo====
themactep commented 6 months ago

https://github.com/themactep/openipc-wiki/blob/master/hardware/components/sensor/detection.md

RoboSchmied commented 6 months ago

https://github.com/themactep/openipc-wiki/blob/master/hardware/components/sensor/detection.md

Thank you.

Here my results:

root@openipc-gk7205v210:~# i2cdetect -l
i2c-1   i2c         goke-i2c                            I2C adapter
i2c-2   i2c         goke-i2c                            I2C adapter
i2c-0   i2c         goke-i2c                            I2C adapter
root@openipc-gk7205v210:~# i2cdetect -yr 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: 30 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@openipc-gk7205v210:~# i2cget -yf 0 0x30 0xf0
0x00
root@openipc-gk7205v210:~# i2cget -yf 0 0x30 0xf1
0x00
root@openipc-gk7205v210:~# i2cdetect -yr 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@openipc-gk7205v210:~# i2cdetect -yr 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@openipc-gk7205v210:~# ls /sys/bus/i2c/devices/ 
0-0036  1-0036  i2c-0   i2c-1   i2c-2
root@openipc-gk7205v210:~# cat /sys/bus/i2c/devices/0-0036/name 
sensor_i2c
root@openipc-gk7205v210:~# cat /sys/bus/i2c/devices/1-0036/name 
sensor_i2c

root@openipc-gk7205v210:~# ipctool i2cdetect
       0  1  2  3  4  5  6  7   8  9  a  b  c  d  e  f
    : xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  10: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  20: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  30: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  40: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  50: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  60: 60 61 xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  70: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  80: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  90: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  a0: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  b0: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  c0: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  d0: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  e0: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx  |  
  f0: xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx 
root@openipc-gk7205v210:~# ipctool i2cdump 0x60 0xf0 0xf2
       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
  f0: 00 00 
root@openipc-gk7205v210:~# ipctool i2cdump 0x61 0xf0 0xf2
       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
  f0: 00 00
themactep commented 6 months ago

Now you need values from registers 0x3107 and 0x3108 at address 0x30. These are the most common with Smartsens sensors.

RoboSchmied commented 6 months ago

Now you need values from registers 0x3107 and 0x3108 at address 0x30.

root@openipc-gk7205v210:~# ipctool i2cdump 0x30 0x3107 0x3108
       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
FFFFFFFF  
root@openipc-gk7205v210:~# ipctool i2cdump 0x60 0x3107 0x3108
       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
CB  
themactep commented 6 months ago

ipctool is kinda stupid and does not include the last region in the sequence. Use 0x3107 0x3109 range.

RoboSchmied commented 6 months ago
# here some more registers:
root@openipc-gk7205v210:~# ipctool i2cdump 0x60 0x3100 0x310F
       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
3100: 00 12 00 08 01 12 05 CB  3E 01 00 00 00 00 00
themactep commented 6 months ago

SC223A 0x60 0x3107:0xCB 0x3108:0x3E 30 1920x1080

themactep commented 6 months ago

Alas, you got tricked by the seller.

RoboSchmied commented 6 months ago

Alas, you got tricked by the seller.

Maybe, but: There are 2 main arguments that speak against the it is sensor sc223a - theory:

@themactep Why is it important to know if it is the sc223a or not:

themactep commented 6 months ago

You have the device ID. I don't know what alternative evidence you are looking for, but I usually try to not getting involved in religious debates and debates with whitneses of SC5239S. That is a pink unicorn sensor even the manufacturer is not aware of. Google the name, you will get all kind of grifters advertizing it with parameters from 3mp to 5mp and mysteriously shapeshifting sizes.

It is the new black to upscale resolution from a shitty 2mp sensor to 2k output, or whatever the soc can handle. E.g. Cinnado D1 2K camera is equipped with SC2336 sensor. Same for dozens of other cameras on the market. Beacause marketing, and people are stupid gullible

The fps you get is from isp, not the sensor.

RoboSchmied commented 6 months ago

The fps you get is from isp, not the sensor.

Here you can see a capture of the stream clearly showing 41 unique frames per second with high-resolution-timer in vid, confirmed by @widgetii.

Nothing religious, pure data. ;)

jimsmt commented 6 months ago

There's possibility that it's SC233A which is capable of 1080p@60fps

RoboSchmied commented 6 months ago

Thank you all for helping.

Here we got the proof that chip ID cb3e is not unique. 3 Sensors (in openipc) are using it.

At the moment, ipctool recognizes all 3 sensors as sc223a.

This issue will be resolved here: https://github.com/OpenIPC/ipctool/issues/112