roleoroleo / yi-hack-Allwinner-v2

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

Beta testing #3

Closed roleoroleo closed 3 years ago

roleoroleo commented 4 years ago

I open this issue to continue this thread https://github.com/roleoroleo/yi-hack-Allwinner/issues/157 in the right place.

mcanteri commented 4 years ago

Ok try mcanteri's backup.

The backup is already available on the original thread under the Allwinner hack. The guy uploaded it to GDrive.

lassieee commented 4 years ago

Ok try mcanteri's backup.

The backup is already available on the original thread under the Allwinner hack. The guy uploaded it to GDrive.

Ah I missed that, thanks!

mcanteri commented 4 years ago

Ok try mcanteri's backup.

The backup is already available on the original thread under the Allwinner hack. The guy uploaded it to GDrive.

Ah I missed that, thanks!

Here are the files :)

https://drive.google.com/drive/folders/1ifFIDG4G0v-aIKrE_4kcy3elXd5Bsae3

roleoroleo commented 4 years ago

Latest build: y21ga_0.0.6.tar.gz r30gb_0.0.6.tar.gz

Let me know if there are any features that don't work.

huntz commented 4 years ago

Hi guys, y21ga_0.0.6.tar.gz on my 1080p Home Camera seems to work fine. Great work!

@roleoroleo I have also an YI Outdoor Camera 1080p 9CUS: how can I get the dump to send to you?

roleoroleo commented 4 years ago

Try if this works: https://github.com/roleoroleo/yi-hack-Allwinner-v2/wiki/Dump-your-backup-firmware-(SD-card)

wimpie007 commented 4 years ago

I have a Yi Dome Guard, model YRS-3019. Is that one supported by the r30gb firmware? Thanks

PS the above "dump-your-backup" script works!

artemy commented 4 years ago

r30gb installed without any issues, but RTSP and snapshot feature doesn't work. Please let me know what kind of additional info you may need, @roleoroleo

roleoroleo commented 4 years ago

Send me a copy of your /dev/shm/fshare_frame_buf file.

huntz commented 4 years ago

Try if this works: https://github.com/roleoroleo/yi-hack-Allwinner-v2/wiki/Dump-your-backup-firmware-(SD-card)

The backup script is not working. The camera booted correctly but the /backup folder was not created. The camera can see correctly the SD card, I've checked.

Maybe this is not an Allwinner camera? Any suggestions?

Thank you!

roleoroleo commented 4 years ago

@huntz Check the fw version in the app.

huntz commented 4 years ago

@huntz Check the fw version in the app.

I did some test: this YI Outdoor Camera 1080p 9CUS works with the yi-hack-v4, so is not based on Allwinner chip. I'll open a ticket on yi-hack-v4 to add the camera model to the docs.

Thank you.

mcanteri commented 4 years ago

Latest build: y21ga_0.0.6.tar.gz r30gb_0.0.6.tar.gz

Let me know if there are any features that don't work.

Hi Roleo and thank you for your work! I found it is missing the bzip2 that is used for the backup of configuration and I'm testing the Rtsp connection with HA: I have an issue but need to understand if it is with HA itself or is the cam, so I need time to go deeper. Do you use HA and maybe know which is the best integration between Yi cam and HA ? I'm actually using the ffmpeg integration because the other cam I have can be integrated only in that way. A thing that I've noticed is that MQTT client on cam is not starting, how can I manually try to start it ?

tominogino commented 4 years ago

Hi everyone! First of all, thank you @roleoroleo for your amazing work!

I'm trying y21ga_006 on my Yi Camera 1080p BFUS with firmware 9.0.19.02 and it's working: RTSP, telnet, ssh, the web interface are all available, but I can't manage to make it work in Home Assistant. It's reported as inactive all the time and even trying to manually start the preview doesn't work.

What am I missing?

roleoroleo commented 4 years ago

I found it is missing the bzip2 that is used for the backup of configuration

The save/restore procedure is not completed. Next release...

and I'm testing the Rtsp connection with HA: I have an issue but need to understand if it is with HA itself or is the cam, so I need time to go deeper. Do you use HA and maybe know which is the best integration between Yi cam and HA ? I'm actually using the ffmpeg integration because the other cam I have can be integrated only in that way.

Imho the RTSP stream implementation on HA is not so good. Don't use yi integration/platform. Use ffmpeg or onvif.

A thing that I've noticed is that MQTT client on cam is not starting, how can I manually try to start it ?

I will check it.

artemy commented 4 years ago

@roleoroleo there you go fshare_frame_buf.zip

mcanteri commented 4 years ago

Imho the RTSP stream implementation on HA is not so good. Don't use yi integration/platform. Use ffmpeg or onvif.

I'm using ffmpeg in this way: camera:

The first is my old camera, working good and stable, the second is the new Yi camera that works good if I connect directly using mplayer or totem (linux) but when I try to see the stream with HA after, let's say, 5 to 10 seconds it stop streaming. (I think that it has this behaviour because the stream is not perfectly clean at the beginning, but mplayer and totem are able to go on visualizing the video, while HA with ffmpeg is going to broke for some reasons. I can see the messages on linux terminal when I connect with mplayer, if you need them I can share.) Yi integration I tried to configure and wasn't working so I turned back to ffmpeg. Onvif I never used and I was reading but it seems not so simple at the beginning, will see if I found something to start with. Have to understand how mosquitto works with cam too (I'm using it with tasmota), not bad to have a switch that tells you about motion in progress. Thank you for your advice.

mcanteri commented 4 years ago

I saw the error now on the HA log and it is as I suspected. Here what it says:

2020-10-20 14:10:14 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://192.168.1.132/ch0_0.h264 2020-10-20 14:10:17 WARNING (stream_worker) [homeassistant.components.stream.worker] Dropping out of order packet: 183214 <= 183214 2020-10-20 14:10:17 WARNING (stream_worker) [homeassistant.components.stream.worker] Timestamp overflow detected: dts = 256537, resetting stream 2020-10-20 14:10:17 INFO (MainThread) [homeassistant.components.stream] Stopped stream: rtsp://192.168.1.132/ch0_0.h264 2020-10-20 14:10:17 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start resp = await task File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/stream/core.py", line 187, in get return await self.handle(request, stream, sequence) File "/usr/src/homeassistant/homeassistant/components/stream/hls.py", line 57, in handle return web.Response(body=self.render(track).encode("utf-8"), headers=headers) File "/usr/src/homeassistant/homeassistant/components/stream/hls.py", line 37, in render segment = track.get_segment(track.segments[-1]) IndexError: list index out of range

This error probably is not so easy to fix without a cam. Do you want me to ship mine or want to setup an ssh tunnel ? Should not take so long to travel 230 km :) :+1:

roleoroleo commented 4 years ago

The first is my old camera, working good and stable, the second is the new Yi camera that works good if I connect directly using mplayer or totem (linux) but when I try to see the stream with HA after, let's say, 5 to 10 seconds it stop streaming. (I think that it has this behaviour because the stream is not perfectly clean at the beginning, but mplayer and totem are able to go on visualizing the video, while HA with ffmpeg is going to broke for some reasons. I can see the messages on linux terminal when I connect with mplayer, if you need them I can share.)

I solved the issue when the stream starts. Which feature do you use to watch video on ha? picture-entity? picture-glance?

Onvif I never used and I was reading but it seems not so simple at the beginning, will see if I found something to start with.

Onvif is simple but ffmpeg is better if you want more control about stream and sensors configuration. If you want to try it, simply start the integration wizard. But there's no difference from using rtsp with ffmpeg because onvif is only a protocol descriptor: for the stream it relies on rtsp.

Have to understand how mosquitto works with cam too (I'm using it with tasmota), not bad to have a switch that tells you about motion in progress.

You can configure a binary sensor with motion detection feature. https://github.com/roleoroleo/yi-hack-Allwinner/wiki/Home-Assistant-integration

This error probably is not so easy to fix without a cam. Do you want me to ship mine or want to setup an ssh tunnel ? Should not take so long to travel 230 km :) 👍

I will send a new version with the starting issue solved but I think this is a bigger problem. Try to start rRTSPServer with -d option and check if there are errors.

roleoroleo commented 4 years ago

A thing that I've noticed is that MQTT client on cam is not starting, how can I manually try to start it ?

Try the following commands:

killall mqttv4
. /tmp/sd/yi-hack/script/env.sh
mqttv4

and chek the output.

roleoroleo commented 4 years ago

Hi everyone! First of all, thank you @roleoroleo for your amazing work!

I'm trying y21ga_006 on my Yi Camera 1080p BFUS with firmware 9.0.19.02 and it's working: RTSP, telnet, ssh, the web interface are all available, but I can't manage to make it work in Home Assistant. It's reported as inactive all the time and even trying to manually start the preview doesn't work.

What am I missing?

Which integration/platform are you using?

mcanteri commented 4 years ago

I solved the issue when the stream starts. Which feature do you use to watch video on ha? picture-entity? picture-glance?

I use: Picture Entity Card Configuration

Have to understand how mosquitto works with cam too (I'm using it with tasmota), not bad to have a switch that tells you about motion in progress.

You can configure a binary sensor with motion detection feature. https://github.com/roleoroleo/yi-hack-Allwinner/wiki/Home-Assistant-integration

Ok, will take a look.

I will send a new version with the starting issue solved but I think this is a bigger problem. Try to start rRTSPServer with -d option and check if there are errors.

Ok 👍

mcanteri commented 4 years ago

. /tmp/sd/yi-hack/script/env.sh

killall mqttv4 killall: mqttv4: no process killed root@Yicam:~# . /tmp/sd/yi-hack/script/env.sh root@Yicam:~# pwd /tmp/sd/yi-hack root@Yicam:~# mqttv4 Starting mqttv4 v0.0.3 Can't open file "/home/yi-hack/etc/mqttv4.conf": No such file or directory Cannot open config file. Skipping. Trying to connect... Segmentation fault (core dumped)

mcanteri commented 4 years ago

About the server launched with the option rRTSPServer -d I can see fro time to time these lines:

frame_len: 1635 - cb_current->size: 196608 0 - fFrameSize 145301 - fMaxSize 4699 - fLimitNumBytesToStream 0 - fPreferredFrameSize 0 2 - fFrameSize 4699 - fMaxSize 4699 - fLimitNumBytesToStream 0 22 - Completed frame_len: 762 - cb_current->size: 49152 frame_len: 1583 - cb_current->size: 196608 frame_len: 753 - cb_current->size: 49152 frame_len: 1609 - cb_current->size: 196608 frame_len: 839 - cb_current->size: 49152 frame_len: 1583 - cb_current->size: 196608 frame_len: 837 - cb_current->size: 49152 0 - fFrameSize 4699 - fMaxSize 149999 - fLimitNumBytesToStream 0 - fPreferredFrameSize 0 2 - fFrameSize 149999 - fMaxSize 149999 - fLimitNumBytesToStream 0 22 - Completed frame_len: 1638 - cb_current->size: 196608

Don't know if they show some problem or it is normal.

roleoroleo commented 4 years ago

At the moment I don't know what to do even if I were connected. I need to study the problem.

About mqtt I will fix it.

mcanteri commented 4 years ago

Ok, in case you need, it's one minute set up 👍

Minor issue, if I disable the cloud, the time of camera start at april 2020, probably the ntp client doesn't work.

roleoroleo commented 4 years ago

@mcanteri Thank you for your donation.

roleoroleo commented 4 years ago

Another beta: y21ga_0.0.7.tar.gz r30gb_0.0.7.tar.gz

pep4n commented 4 years ago

hmm coming from 0.0.5. y21ga_0.0.7.tar.gz is not booting here. I cleared root and copied 0.0.7 files. LED stays yellow. At least 10 minutes now...

Is anybody else experiencing a similar behaviour?

huntz commented 3 years ago

I was coming from 0.0.6 and the 0.0.7 beta is booting up; so @pep4n 0.0.7 is working as expected.

I have erased the SD before copying the 0.0.7 files.

My only bug with beta 0.0.7 is the "High res snapshot" and the "Low res snapshot" not working (trying to run snapshot.sh from shell, snapshot.sh: line 37: imggrabber: not found)

KennyVDL commented 3 years ago

I have version 0.0.7 The installation works without problems But I can't connect to my FTP server and can't upload files

wimpie007 commented 3 years ago

@huntz @KennyVDL y21ga_0.0.7.tar.gz or r30gb_0.0.7.tar.gz?

huntz commented 3 years ago

@huntz @KennyVDL y21ga_0.0.7.tar.gz or r30gb_0.0.7.tar.gz?

y21ga

artemy commented 3 years ago

My only bug with beta 0.0.7 is the "High res snapshot" and the "Low res snapshot" not working (trying to run snapshot.sh from shell, snapshot.sh: line 37: imggrabber: not found)

I've fixed this with addin yi-hack/bin to PATH: PATH=$PATH:/tmp/sd/yi-hack/bin But now there's another issue:

root@(none):/tmp/sd/yi-hack/www/cgi-bin# imggrabber -r high
Starting program
Could not open file /tmp/iframe.idx

that's with the latest master build as of this hour


Ok I see that framefinder apparently writes to that file and if I run it directly it crashes immediately with Segmentation fault (core dumped)

KennyVDL commented 3 years ago

y21ga_0.0.7.tar.gz

roleoroleo commented 3 years ago

I have version 0.0.7 The installation works without problems But I can't connect to my FTP server and can't upload files

Some details?

roleoroleo commented 3 years ago

I've fixed this with addin yi-hack/bin to PATH: PATH=$PATH:/tmp/sd/yi-hack/bin

If you use a shell you have to source . /tmp/sd/yi-hack/script/env.sh To extend the PATH

But now there's another issue:

root@(none):/tmp/sd/yi-hack/www/cgi-bin# imggrabber -r high
Starting program
Could not open file /tmp/iframe.idx

that's with the latest master build as of this hour


Ok I see that framefinder apparently writes to that file and if I run it directly it crashes immediately with Segmentation fault (core dumped)

I need to change some lines of code to fix rtsp and snapshot for r30gb. Now imggrabber can't work.

mcanteri commented 3 years ago

Another beta: y21ga_0.0.7.tar.gz r30gb_0.0.7.tar.gz

Hi Roleo, I tried the code before this new commit and I saw that was still working alone but the integration with HA was having the same problem. Now tried this last and actually the stream for me is not working very well, audio is gone and there are more artefacts than before, with mplayer. Snapshot aren't working anymore via links and with the specific page too.

Edit: actually in HA I just checked and the stream is more stable, it miss audio but looks more fluent and keep flowing. Now in log I found only:

2020-10-22 20:30:10 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://192.168.1.132/ch0_0.h264 2020-10-22 20:30:12 WARNING (stream_worker) [homeassistant.components.stream.worker] Dropping out of order packet: 76730 <= 76730

and video keep working. Is a step ahead than before :+1:

pep4n commented 3 years ago

I was coming from 0.0.6 and the 0.0.7 beta is booting up; so @pep4n 0.0.7 is working as expected.

I have erased the SD before copying the 0.0.7 files.

Thanks for the headsup. Just wonder how I ended up with a soft (?) bricked device now. I just deleted the 0.0.5 files and copied 0.0.7 files.

Now even without SD doesn't boot up to factory anymore. LED stays yellow. :(

roleoroleo commented 3 years ago

Now even without SD doesn't boot up anymore. LED stays yellow. :(

?!?

pep4n commented 3 years ago

yeah it just stays yellow. no blue in sight... also not the usual click sound when booting up

roleoroleo commented 3 years ago

Do you have an idea of the reason? Is telnet working? Same problem happened to @lassieee ? We need to understand why...

roleoroleo commented 3 years ago

Another update: y21ga_0.0.8.tar.gz r30gb_0.0.8.tar.gz

@artemy Please try r30gb version.

pep4n commented 3 years ago

It even gets more strange now! I'm trying to reproduce the issue. Just unpacked a brand new cam to dump a backup (https://github.com/roleoroleo/yi-hack-Allwinner/wiki/Dump-your-backup-firmware-(SD-card) ) and try 0.0.7 there. Guess what: now 2nd cam "dead" also. just plain yellow LED. and even before the hack. just while trying to dump a backup... removing the sd ends up with same behaviour.

Could the SD card be the killer? It was brand new. just once formated with cams internal tool.

roleoroleo commented 3 years ago

This is the code of the backup procedure:

echo "############## Starting Firmware Dump ##############"

mkdir -p /tmp/sd/backup

cat /proc/mtd > /tmp/sd/backup/mtd.txt

dd if=/dev/mtdblock0 of=/tmp/sd/backup/mtdblock0.bin
dd if=/dev/mtdblock1 of=/tmp/sd/backup/mtdblock1.bin
dd if=/dev/mtdblock2 of=/tmp/sd/backup/mtdblock2.bin
dd if=/dev/mtdblock3 of=/tmp/sd/backup/mtdblock3.bin
dd if=/dev/mtdblock4 of=/tmp/sd/backup/mtdblock4.bin
dd if=/dev/mtdblock5 of=/tmp/sd/backup/mtdblock5.bin
dd if=/dev/mtdblock6 of=/tmp/sd/backup/mtdblock6.bin
dd if=/dev/mtdblock7 of=/tmp/sd/backup/mtdblock7.bin

if [ -e /tmp/sd/Factory ]; then
    mv /tmp/sd/Factory /tmp/sd/Factory.done
fi

reboot

I can't understand how this code could be the reason of your brick. There aren't changes to the file system: no writes to the internal flash, no writes to memory, only writes to external sd.

I would like to have a dump of your cam. Maybe I could find the problem. Are you able to make a dump with a serial connection? With a serial connection we could also restore the cam.

pep4n commented 3 years ago

its definetely not the code! it seems it was the USB cable/charger!

So strange since I used this cable and charger combination all the time. By curiosity I tried the original one. Booting up again... Also 0.0.7 now! :)

roleoroleo commented 3 years ago

So, no bricked cams?

pep4n commented 3 years ago

just feeling so embarrassed now but: no, no bricked cam so far ,)

roleoroleo commented 3 years ago

No problem.

pep4n commented 3 years ago

In general 0.0.7 works. I see quite a delay in RTSP stream compared to the one from the app. As mentioned already IP:8080/?page=snapshot is not working. Now also the links (IP:8080/cgi-bin/snapshot.sh?res=high&watermark=yes) to snapshot seem to be broke: "Picture "IP:8080/cgi-bin/snapshot.sh?res=high&watermark=yes" can't be displayed, because it contains errors."

Also struggling to setup FTP export. Is there any way to get a log for the FTP connection?