cjj25 / Yi-RTS3903N-RTSPServer

A RTSPServer for RTS3903N based IP Cameras (Yi Camera Inspired)
67 stars 13 forks source link

Works with Apeman IH74 #27

Closed ptersilie closed 2 years ago

ptersilie commented 2 years ago

I can confirm that this works with the Apeman IH74 (which I believe is also sold as Voger VP230 and possibly others). image

Firmware: 7.1.00.19A_201910181012

The only issue I encountered was that the RTSP stream by default was flipped upside down. But that was easily fixed by setting RTS_VIDEO_CTRL_ID_FLIP accordingly:

diff --git a/build/src/stream.c b/build/src/stream.c
index 3991826..1375e2c 100644
--- a/build/src/stream.c
+++ b/build/src/stream.c
@@ -249,6 +249,7 @@ int start_stream() {
     rts_av_enable_chn(h264);
     manage_modes(RTS_VIDEO_CTRL_ID_NOISE_REDUCTION, 100);
     manage_modes(RTS_VIDEO_CTRL_ID_LDC, 1);
+    manage_modes(RTS_VIDEO_CTRL_ID_FLIP, 1);
 //    manage_modes(RTS_VIDEO_CTRL_ID_FOCUS, 100);
     manage_modes(RTS_VIDEO_CTRL_ID_DETAIL_ENHANCEMENT, 100);
     manage_modes(RTS_VIDEO_CTRL_ID_3DNR, -1);
cjj25 commented 2 years ago

Thanks for the feedback @ptersilie - Can you confirm your camera is Yi based and not Tuya?

I actually have the Voger VP230 (physically identical) sitting in a box of cameras to help with my research, it's the RTS3903N but with Tuya's cloud software. They sold for really cheap on Amazon for around £11 each.

There's a separate repo just for the Tuya implementation here: cjj25/RTS3903N-Tuya-RTSPServer

ptersilie commented 2 years ago

The firmware of the camera is 7.1.00.19A_201910181012 and the scripts in this repo worked, which leads me to believe it is indeed Yi based. Is there a way to tell for sure?

Also while I have you here. Do you know what arguments I need to use for RTS_VIDEO_CTRL_ID_ROTATE. I noticed that FLIP wasn't enough as the image is then mirrored, so I would have to use FLIP and MIRROR. I reckon just using ROTATE might be easier, but I'm not sure if it expects an angle e.g. 180 or a direction e.g. 3 for 180 degrees.

cjj25 commented 2 years ago

You're absolutely right, I should have noticed the version number as a clue! That is indeed a Yi camera.

Unfortunately the very limited SDK didn't provide any details as to the possible values.

However, I noticed we can use rts_av_get_isp_ctrl to help find the appropriate values.

https://github.com/cjj25/Yi-RTS3903N-RTSPServer/blob/7763840399c08659c6b2e875bc4bca5a30f7f58b/build/src/stream.c#L116-L136

The populated ctrl struct has the following: ctrl->minimum, ctrl->maximum and ctrl->step - if you printf these values, you'll find what's available for any configurable item. _Notice get_valid_value loops through these values to enforce that a value is set (if the desired value is wrong, too high or too low)_

You might find my RTS3903N-Tools repo useful too, I think the rts_isp_cmd and dbg_isp allow you to query the rts_av_get_isp_ctrl directly from the command line (not checked).

ptersilie commented 2 years ago

Thanks! I'll have a look later. Do you know where the binaries in https://github.com/cjj25/RTS3903N-Tools/tree/master/Realtek%20Specific come from? Do you have a source for those or are they from some kind of closed SDK?

cjj25 commented 2 years ago

Unfortunately those binaries are from a closed SDK. That whole repo is a combination of binaries collected from either similar camera dumps, limited SDKs and/or manually compiled binaries.

Would you be able to provide a copy of your firmware backup that was automatically generated on the root of your sdcard? Any interesting / useful binaries found get added to the tools repo.

cjj25 commented 2 years ago

I'm closing this issue for now - please feel free to add any discoveries you make regarding the parameters :)

ptersilie commented 2 years ago

Hey, sorry, I didn't get around looking into this further yet, but will update this issue when I do. And thanks again for your help! :-)