OpenIPC / majestic

Majestic Community edition integration kit
MIT License
32 stars 5 forks source link

PTZ support. Can I make a majestic plugin to support PTZ over onvif / web ? #176

Closed Regressor closed 2 weeks ago

Regressor commented 3 weeks ago

Hi. I tried to run OpenIPC on Xiaomi C200 (MJSXJ14CM, T31L, gc2083 sensor, ptz thru /dev/motor ioctl, gpio based ircut/irled) and it work (currently I run majestic using manu.sh script hack).

I mounted latest T31L squashfs image, --bind mounted proc, dev, etc (writable), tmp and other dirs. And then chrooted there and tried to run majestic. Sensor detection not good - it founds gc2083_i2c and can't start it.

But it works after exporting SENSOR=gc2083! Video and audio streams, output audio, auto day-night works as a charm. Enabling OSD lead to segmentation fault after start.

PTZ not work, but I made a small web-server with daemon to calibrate/pan/tilt camera.

Is there any way to make native ptz support (e.g. using scripts or plugins) ? Is there any docs about it ? How can I help with it?

flyrouter commented 3 weeks ago

Hello Thanks for your work and messages Please take a look at the latest commits in the Firmware repository where one of our colleagues is doing something similar based on onvif-simple-server. Maybe you should join him? https://github.com/OpenIPC/firmware/pull/1525 https://github.com/OpenIPC/firmware/pull/1524

Regressor commented 3 weeks ago

Hello Thanks for your work and messages Please take a look at the latest commits in the Firmware repository where one of our colleagues is doing something similar based on onvif-simple-server. Maybe you should join him? OpenIPC/firmware#1525 OpenIPC/firmware#1524

This is just /usr/bin/motor binary for another camera and ONVIF_SIMPLE_SERVER_VERSION change. Can't found a onvif server changes to use /usr/bin/motor.

Regressor commented 3 weeks ago

I find out how to get onvif ptz (disable majestic onvif, start onvif_simple_server, setup actions to ptz up/down/right/left).

But there are many other problems. So I decide to try thingino. Majestic too buggy - I can't setup second video stream (sdk stream can't start), osd not working (segmentation fault), day-night not working and majestic is not open source so I can't do anything with it to fix problems.

skilurius commented 2 weeks ago

Are you sure you were using the most recent version? I checked with a T31ZX+GC2053, substream and osd are working fine.

I mounted latest T31L squashfs image, --bind mounted proc, dev, etc (writable), tmp and other dirs. And then chrooted there and tried to run majestic. Sensor detection not good - it founds gc2083_i2c and can't start it.

This does not sound like a proper setup, have you checked the uboot environment and set the correct memory values?

Regressor commented 2 weeks ago

Are you sure you were using the most recent version? I checked with a T31ZX+GC2053, substream and osd are working fine.

I mounted latest T31L squashfs image, --bind mounted proc, dev, etc (writable), tmp and other dirs. And then chrooted there and tried to run majestic. Sensor detection not good - it founds gc2083_i2c and can't start it.

This does not sound like a proper setup, have you checked the uboot environment and set the correct memory values?

I was using latest version (hw: T31L + 2083). Now i switched to Thingino, mounted rootfs image and it works without any problem. Also I found Xiaomi used a secureboot in C200 camera (spl sig checked, uboot sig checked, uImage sig checked, bootargs/bootcmd resets every boot). So uImage and uboot cannot be replaced.

The guys from thingino give me an idea to stop original uboot, and run new modified uboot (changed env offset) using sf read xxx; go xxx and and this helps - all functions woks, so the only problem now is a automatic start of second uboot .

I'll solder arduino there to wait uboot message, stop boot and send sf read xxx;go xxx

skilurius commented 2 weeks ago

It seems T31L has only 64MB ram, so the block count needs to be set to 1: cli -s .isp.blkCnt 1

Otherwise you will run out of memory (segmentation fault), but that is how the sdk works.

flyrouter commented 2 weeks ago

I find out how to get onvif ptz (disable majestic onvif, start onvif_simple_server, setup actions to ptz up/down/right/left).

But there are many other problems. So I decide to try thingino. Majestic too buggy - I can't setup second video stream (sdk stream can't start), osd not working (segmentation fault), day-night not working and majestic is not open source so I can't do anything with it to fix problems.

In order to work with video on devices with small memory, you need to configure them correctly. We have descriptions of the parameter settings in the Wiki and most likely your problem is related to the incorrect number of blocks for video memory and you need to set it to 1. You may also need to tune the device memory to distribute it correctly between Linux and ISP. As for the source code, we have not only Majestic but also other streamers. Since you have no interest in studying this, perhaps the solution you found is correct for your case.