roleoroleo / yi-hack-Allwinner-v2

Custom firmware for Yi 1080p camera based on Allwinner platform
MIT License
808 stars 92 forks source link

Yi Dome Guard YRS.3019 RTSP broken on yi-hack-Allwinner-v2 0.3.2 #909

Open maxromanovsky opened 1 month ago

maxromanovsky commented 1 month ago

As others experienced, RTSP broken on yi-hack-Allwinner-v2 0.3.2 for Yi Dome Guard YRS.3019. In my case, VLC can't connect and display the stream.

Firmware Version 0.3.2 Base Version 12.1.05.1_202302091435

As @Solarbotics pointed out, editing <sd>/yi-hack/model_suffix file contents to r35gb resolves the issue.

Maybe it's an issue with Base Version 12.1.05.1_202302091435? Update 1: I have another camera with Base Version 9.0.05.33_202009251856, and it works just fine with VLC However, both versions don't work with Synology Surveillance Station 9.2.0 (w/o login/password or with login/password, Fault response if unknown request: on, Synology NVR compatibility: on)

Update 2: Base Version 9.0.05.33_202009251856, hack v0.2.6 works with Synology Surveillance Station 9.2.0 with login/password

I decided to create a separate issue out of https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/484 because

roleoroleo commented 1 month ago

I double checkde the fw versione and 12.1.05.1_202302091435 refers to r30gb. It could be a problem with the codec. Could you please send me a copy of the frame buffer /dev/shm/fshare_frame_buf ?

About onvif, between 0.2.6 and 0.3.2 I completely changed the daemon. But I already tested Synology Surveillance Station with this new software and the test was successful. Did you try to enable/disable the advanced options you mention above? If it doesn't work, I need a network traffic between the cam and the Synology to check the messages.

roleoroleo commented 1 month ago

Tested again now with DSM 7 and Surveillance 9.2.0-11289. It works. Please, explain me what's the problem.

maxromanovsky commented 1 month ago

@roleoroleo I just went on a trip, and will check it upon return in about a week or so.

maxromanovsky commented 3 weeks ago

@roleoroleo sorry it took me longer.

Here's what I did:

It seems rtsp is NOT working:

root@(none):/tmp/sd/log# ps | grep rtsp
 1923 root       992 S    {wd_rtsp.sh} /bin/sh /tmp/sd/yi-hack/script/wd_rtsp.sh
10434 root       992 S    {wd_rtsp.sh} /bin/sh /tmp/sd/yi-hack/script/wd_rtsp.sh
10441 root       980 S    grep rtsp

I've also enabled the rtsp log by uncommenting LOG_FILE="/tmp/sd/wd_rtsp.log" and commenting LOG_FILE="/dev/null" in /yi-hack/script/wd_rtsp.sh

root@(none):/tmp/sd# cat wd_rtsp.log
2024-08-18 15:46:03 - Starting RTSP watchdog...
2024-08-18 15:46:04 - Restarting rtsp process
2024-08-18 15:46:17 - Restarting rtsp process
2024-08-18 15:46:31 - Restarting rtsp process
2024-08-18 15:46:44 - Restarting rtsp process
2024-08-18 15:46:57 - Restarting rtsp process
roleoroleo commented 2 weeks ago

The frame buffer is ok. Frames as expected: h264 supported by rRTSPServer. Please, run the server with the full log:

killall wd_rtsp.sh
killall rRTSPServer
rRTSPServer xxx -d 15

where 'xxx' are your current options.

maxromanovsky commented 2 weeks ago

@roleoroleo

Thanks for the response.

Frames as expected: h264 supported by rRTSPServer.

I wonder if it should be h264, as AFAIK this camera by default outputs h265, and that's what this fix was supposed to change: https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/484#issuecomment-1235411673

Here's the output. VLC or nc still fail to connect. capture - buf_idx_end == buf_idx_end_prev line is repeating indefinitely:

root@(none):~# ps | grep rRTSPServer
28695 root      4924 S<   rRTSPServer -m r30gb -r high -a yes -p 554
28752 root       980 S    grep rRTSPServer
28757 root       980 S    grep rRTSPServer

root@(none):~# killall wd_rtsp.sh
root@(none):~# killall rRTSPServer

rRTSPServer -m r30gb -r high -a yes -p 554 -d 15

root@(none):~# rRTSPServer -m r30gb -r high -a yes -p 554 -d 15
1723998736198: the size of the buffer is 1786156
unable to find /tmp/audio_fifo, audio disabled
1723998736201: capture - mapping file fshare_frame_buf, size 1786156, to b6c40000
1723998736203: capture - closing the file fshare_frame_buf
1723998736203: capture - starting capture main loop
1723998736204: capture - buf_idx_end == buf_idx_end_prev
1723998736214: capture - buf_idx_end == buf_idx_end_prev
1723998736225: capture - buf_idx_end == buf_idx_end_prev
1723998736236: capture - buf_idx_end == buf_idx_end_prev
1723998736246: capture - buf_idx_end == buf_idx_end_prev
1723998736257: capture - buf_idx_end == buf_idx_end_prev
1723998736267: capture - buf_idx_end == buf_idx_end_prev
1723998736277: capture - buf_idx_end == buf_idx_end_prev
1723998736287: capture - buf_idx_end == buf_idx_end_prev
1723998736297: capture - buf_idx_end == buf_idx_end_prev
1723998736308: capture - buf_idx_end == buf_idx_end_prev
1723998736318: capture - buf_idx_end == buf_idx_end_prev
1723998736328: capture - buf_idx_end == buf_idx_end_prev
1723998736338: capture - buf_idx_end == buf_idx_end_prev
1723998736348: capture - buf_idx_end == buf_idx_end_prev
roleoroleo commented 2 weeks ago

Yes, the buffer contains 2 different h264 streams: low and high res. You can check the file looking for SPS frames (they starts with the hex sequence 00 00 00 01 67).

The log is not ok, the parser is unable to find the frames and the capture thread does not start. I don't know why, I have to check the code. But I'm afk for a while.

maxromanovsky commented 2 weeks ago

I wonder why the firmware changed from h265 to h264... No big deal, let's keep the PR open, and I will make a gentle reminder in a month or so :) In the meantime I will also be away every other week

roleoroleo commented 1 day ago

The length of the header is changed. In the previous fw version was 22, your version is 26. I have to change the parser.

roleoroleo commented 1 day ago

But... Are you sure it's a R30GB? Could you send me a backup of the flash?

maxromanovsky commented 11 hours ago

@roleoroleo backup attached. I edited mtdblock7.bin and replaced wifi ssid & pwd with x

I am traveling, so can't take a photo of the device itself, but I'm pretty sure it's R30GB.

Archive.zip

Check out issues linked in the description: others are complaining about the same

roleoroleo commented 6 hours ago

Please, try this binary: rRTSPServer.gz