roleoroleo / sonoff-hack

Custom firmware for Sonoff GK-200MP2B camera
GNU General Public License v3.0
201 stars 48 forks source link

RTSP fails after a few minutes #55

Closed ghost closed 4 months ago

ghost commented 3 years ago
Firmware Version 0.1.0
Model GK-200MP2B
Base Version V2524.1.245build20191030
Hack Version 0.1.0

The device is connected via ethernet, but I've fully blocked it from accessing the WAN through my router. I've disabled cloud access and set the ntp server to my router. Swap File is enabled.

After a few minutes (<10) of being turned on, the RSTP streams and the snapshot become unresponsive. I would watch them function normally on VLC and then lose connection and not be able to reconnect until I reboot the device.

I don't know how different this is from yi-hack-Allwinner but they seem to have a problem viewing RTSP when the internet is blocked.

I'm not sure how to debug or where logs are located but I can upload them if someone tells me where they are.

Thanks

Edit: After the failure I found that running "/mnt/mtd/ipc/app/avencode" again will bring the stream back up and it will stay back up indefinitely(so far). So if nobody can fix crash issue, could someone help me make a script to automatically restart avencode when it fails? I'm not used the the process management system under busybox.

roleoroleo commented 3 years ago

If you open the internet access (just for this test) does the cam work? If you don't call a snapshot but you read rtsp stream does the cam work?

ghost commented 3 years ago

I'm unable to allow internet access on my network right now but I have been using a hacky solution.

So it doesn't matter if I view the rtsp or snapshot, both fail in less than 10 minutes. When I manually restart the avencode it will stay up for a few hours, maybe 4 maybe 8 or so, but it will go down again.

My hacky solution is to create this file:

/mnt/mmc/sonoff-hack/script/restart_avencode.sh

#!/bin/ash
is_running=$(ps | grep '/mnt/mtd/ipc/app/a[v]encode' | awk '{print $1}');

echo $is_running;
if [ -z $is_running ]; then
    /mnt/mtd/ipc/app/avencode
fi

After creating this file I add a crontab input in the web ui. * * * * * /mnt/mmc/sonoff-hack/script/restart_avencode.sh

Sure it could take up to a minute to restart the service, but realistically the service only stays down a max of 2 or 3 minutes a day now which is great for me.

I wanted to use /etc/inittab to auto restart the service there, but it seems I can't change the inittab functionality after boot.

roleoroleo commented 3 years ago

I will add a watchdog to control avencode like in the yi cams.

roleoroleo commented 3 years ago

https://github.com/roleoroleo/sonoff-hack/commit/7196b2c9b3d4e4e490aed5e837034830678dc7d9

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.