Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mp4s not saving to SD card #7

Open
mrlt8 opened this issue May 8, 2021 · 21 comments
Open

mp4s not saving to SD card #7

mrlt8 opened this issue May 8, 2021 · 21 comments

Comments

@mrlt8
Copy link
Contributor

mrlt8 commented May 8, 2021

Hi Charlie, found another SD related bug.

I noticed that I wasn't getting any recording under the "View Playback" section of the wyze app, so I took a look at the SD card and could see the folders for each of the days in /media/mmc/recordings/ were being created, but had some weird characters at the end:

47.9M   /media/mmc/record/20210503
16.0K   /media/mmc/record/20210506?w
16.0K   /media/mmc/record/20210507?w

Got the same result after formatting the card:

16.0K   /media/mmc/record/20210507Ew
16.0K   /media/mmc/record/20210507Yw
16.0K   /media/mmc/record/20210507lw

Replicated the issue on a couple of other cameras as well.
The folders normally have a %Y%m%d format, but for some reason they are getting a random character + w at the end of the directory name.

The files in /alarm and /time_lapse seem unaffected and are getting created normally.

@FiveLeavesLeft
Copy link
Owner

Interesting, I'll take a look. I assume this V2 with the software that requires the wyzehacks install?

@mrlt8
Copy link
Contributor Author

mrlt8 commented May 8, 2021

Yup, V2 latest stream_hack.

@FiveLeavesLeft
Copy link
Owner

I'm still looking at this, it's a tricky memory overrun issue in the wyze code or wyzehacks code. Could even be a compiler bug but I doubt it. The wyzehacks C code is triggering it, but it's not clear yet where or why exactly.

@endertable
Copy link

You bring up a very good point @FiveLeavesLeft I was wondering why I was not encountering a lot of the same issues you guys were as far as events not logging and this possible issue, but it might be because I don’t use the Wyze hacks. Some of these issues may have to do with the library that wyze_hacks main.sh loads on start up.

@mrlt8
Copy link
Contributor Author

mrlt8 commented May 11, 2021

Thanks for the update @FiveLeavesLeft!

@endertable Are you running stream_hack without wyze_hacks?

@endertable
Copy link

Yes, Mostly because I don’t used NFS recording saving. I use SD cards and access videos remotely as needed.

@mrlt8
Copy link
Contributor Author

mrlt8 commented May 11, 2021

Same here. I only have STREAM_HACK enabled in my wyze_hack.cfg. Everything else is commented out.

Are your events being recorded to the /record directory on your SD card?

@endertable
Copy link

I have all events recorded to SD card and to the cloud. If you are using wyze hacks did you disable the wyze hacks .so library file from being loaded?

@ZuluSpl0it
Copy link

I haven't seen the weird characters at the end, but I did notice that the mp4s were not being saved. The permissions for the "record" folder were different than the alarm folder. I did a
chmod 755 record
from the Camera via telnet and now it saves the mp4s. I have a v2 running WyzeHacks 0.5.06

@FiveLeavesLeft
Copy link
Owner

I can fix the record directory and funny characters issue, but it would mean disabling the wyzehacks NFS functionality. So far I've been avoiding that but I'm curious how many people are using the stream hack and the wyzehacks NFS functionality.

@gtxaspec
Copy link

gtxaspec commented May 14, 2021 via email

@mrlt8
Copy link
Contributor Author

mrlt8 commented May 14, 2021

I personally don’t use the NFS option, but know it’s a popular hack.

Maybe you could disable wyze hacks if none of the NFS options are enabled? Would that break anything else?

@ZuluSpl0it
Copy link

ZuluSpl0it commented May 14, 2021

@FiveLeavesLeft Could you work with HclX/WyzeHacks to fix the permissions issue there? That might be able to keep the NFS working.

Please refer to: HclX/WyzeHacks#91 (comment)

@endertable
Copy link

If you are using NFS v4 you may get strange chmods on directories if users are different. You are using rooot on the camera, but it seems like you are using pi on the Linux server. Try using the root user on your Linux NFS server to see what it does

@mrlt8
Copy link
Contributor Author

mrlt8 commented May 15, 2021

I believe WyzeFirmwareTool also ran into some compatibility issues with NFS and WyzeHacks and had to drop support for both.

I haven't seen the weird characters at the end, but I did notice that the mp4s were not being saved. The permissions for the "record" folder were different than the alarm folder. I did a
chmod 755 record
from the Camera via telnet and now it saves the mp4s. I have a v2 running WyzeHacks 0.5.06

Is your /record on the SD card or on an NFS server?
All the folders in my /media/mmc are drwxr-xr-x root root by default.

@ZuluSpl0it
Copy link

ZuluSpl0it commented May 15, 2021

The record folder is on the NFS which is running v3. What's weird is that the other folders have the correct permissions when created.

My NFS options used are /mnt/nfsshare *(rw,all_squash,insecure,async,no_subtree_check,anonuid=1000,anongid=1000).
.
So the anonymous login from the camera should use pi's UID and GID. (1000)

@ZuluSpl0it
Copy link

I ran the NFS server on a real raspberry pi 3 (unlike the virtualized Raspberry Pi Desktop for PC i was using earlier) and the camera records without any permissions issues. The folders and mp4 get created as expected.

@endertable
Copy link

It is pretty much purely an NFS server issue and not an issue of stream hacks. iCamera does not have to worry about changing permissions on an SD card because default permissions for Linux for a vfat filesystem are 755 no matter what. You couldn’t change permissions on an SD card if you wanted. Because of security, some NFS servers don’t like those loose permissions and use stricter default unmasks, others don’t care. Either way, I don’t believe iCamera issues a chmod command for SD card IO operations and therefore won’t issue them on the NFS mount either. It’s good you found an NFS with a good umask.

@mrlt8
Copy link
Contributor Author

mrlt8 commented May 26, 2021

I have all events recorded to SD card and to the cloud. If you are using wyze hacks did you disable the wyze hacks .so library file from being loaded?

Are you disabling the Wyzehacks in /tmp/wyze_hack/run/main.sh?

@endertable
Copy link

I don’t use WyzeHacks per se so I am only guessing that may be why I am not having a lot of the same issues as some. But I did dabble with it last year and I remember he used a custom .so file to load app_init.sh and I am guessing he is still using it somewhere in the main.sh file. I imagine its main purpose is to prevent iCamera from screwing around with the /media directory for the NFS mount hack to work.

@mrlt8
Copy link
Contributor Author

mrlt8 commented Jun 1, 2021

Here's a bash script that temporarily fixes the issue by creating a folder for today and removing all the junk folders:

#!/bin/sh

while : ; do
    [[ $(ls -d /media/mmc/record/*w | wc -w) -ge 1  ]] && rm -r /media/mmc/record/*w/
    [[ ! -d /media/mmc/record/$(date +'%Y%m%d') ]] && mkdir /media/mmc/record/$(date +'%Y%m%d')
    sleep 3600
done

This obviously needs to be run at least once a day to cleanup and create the dir for today, so I have it sleep and run every hour since the camera doesn't have cron.


Not sure if this is related to wyzehacks or just the way vanilla wyze works, but I noticed that the camera continuously writes a new file every min (record/<day>/<hour>/<min>.mp4) regardless of motion, THEN deletes the file IF there was no motion..

I always assumed the "Events Only" record option in the Wyze app only wrote to the SD card IF there was motion, but it seems like it will continuously write which could have an impact on the life of the SD card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants