guardianproject / haven

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
https://guardianproject.github.io/haven/
GNU General Public License v3.0
6.62k stars 728 forks source link

in 0.2.0-beta4 video recording appears error-prone #347

Open deviantollam opened 6 years ago

deviantollam commented 6 years ago

i've opted for the nightly builds on F-Droid. i'm now running 0.2.0.-alpha4 (117)

during testing, i've enabled video recording for a relatively short duration... i've tried 15 seconds and 30 seconds. when camera events are triggered now, the following result will happen:

  1. the device display says "RECORDING" in red
  2. the device creates a whole mess of JPG images that don't really show much
  3. the device seems to /try/ to record video files. but they are never 15 or 30 seconds or whatever i've configured
  4. the video files that get recorded tend to be about 2 or 3 seconds only, and similarly don't really show anything useful
  5. often, other video files are also saved, but they are broken/have no frames/etc

so as a monitoring tool, unfortunately this isn't really working for me now. arg.

deviantollam commented 6 years ago

i'm also sad to report that the Camera Sensitivity settings are really hard to get right now, it seems.

i filmed a device where i was trying to get the settings right...

https://www.youtube.com/watch?v=Sx1oCZ3FCg4

...in the first segment of the video, the Camera Sensitivity value is set around "8500" (whatever that value means) and then at the 8 second mark you see the preview after the sensitivity has been adjusted to about "11000"

While the device can detect my finger appearing in the field of view... from this perspective it will not detect anyone opening the door and entering the room. I have to cross the room and make it all the way up to about 2' from the phone before it decides to record.

EDIT - it seems the camera sensitivity wasn't the problem. we've isolated that it's a "capture video" problem... turning that on causes much of the monitoring to break.

deviantollam commented 6 years ago

ok... so maybe this isn't related to camera sensitivity... this may be related to when the screen is off. although i have successfully gotten Haven to detect camera events with the screen off (and capture video, send video to me, etc) in the past... something has happened now and it won't work anymore.

i'm going to uninstall 0.2.0-beta4, remove all settings, and try re-installing again. i'm going to troubleshoot the hell out of this today in an attempt to isolate what is preventing the app from doing any real monitoring and detection.

deviantollam commented 6 years ago

ok, i've totally uninstalled and wiped. i've re-installed 0.2.0-beta4.

i've configured the camera sensitivity setting to something reasonable and then configured audio and movement to their highest settings i could (120 and 100, respectively) so i want to only focus on the camera.

i've set up Signal and run a test message. the test message reached me perfectly.

first i will do a series of tests with the screen on, then i'll see what's happening with the screen turned off.

deviantollam commented 6 years ago

first test and result...

video monitoring: enabled android screen: left on detection: app reports that it detected log entry: created, says it captured two images and two videos contents of log: two JPGs worked, one MP4 (only 3 seconds long, despite setting configured for 30 seconds) and one broken MP4 that doesn't play notification: not sent to remote device (even though other notification tests work)

deviantollam commented 6 years ago

second test and result...

video monitoring: disabled android screen: left on detection: app detected movement in front of camera log entry: created, says it captured 27 events. wow! contents of log: lots of JPG images. i did a burst of movement, then waited a few seconds, then more movement... and it took photos of all of that notification: yes! one Signal message came (with the very first image attached)

so that tells us that Video Monitoring is perhaps the key problem?

deviantollam commented 6 years ago

third test and result...

video monitoring: disabled android screen: turned off and locked (during the delay window) detection: app detected movement in front of camera log entry: created, says 29 events contents of log: found a bug there were 29 JPG images, and the preview thumbnails all look different, but tapping to view the full size images will constantly and repeatedly only show the first image. no matter what thumbnail is tapped, only the first captured image is shown. using a file explorer in Android will allow viewing and proper opening of all the JPGs, however. notification: yes. one Signal message came (with the very first captured image attached)

so screen off versus screen on doesn't seem to be the problem.

deviantollam commented 6 years ago

fourth test and result...

video monitoring: disabled android screen: turned off and locked (during the delay window) heartbeat: enabled detection: app detected movement in front of camera log entry: created, says 16 events (i didn't do as much movement this time) contents of log: found same bug there were 16 JPG images, and the preview thumbnails all look different, but tapping to view the full size images will constantly and repeatedly only show the first image that was captured. no matter what thumbnail is tapped, only the first captured image is shown. (i even tried making my initial tap upon an entry later in the list, no the first entry. still, it was the first image that was displayed) using a file explorer in Android will allow viewing and proper opening of all the JPGs, however. notification:

yes. one Signal message came (with the very first captured image attached) so screen off versus screen on doesn't seem to be the problem AND heartbeat being enabled doesn't seem to be the problem. it's all about video monitoring. that seems to break everything.

deviantollam commented 6 years ago

for reference, my test device at this time is...

Nokia 3.1, model TA-1049 Android 8.0.0 (Kernel 3.18.60+)

lukeswitz commented 6 years ago

Changed some lines and had a smooth session, only works for devices tested < 21.

Seems that introducing the Camera 2 API in new branch holds same problems for old devices using the deprecated version; fails using the following:

None of the above are persistent issues on flagship and newer AOS, however that doesn’t cover half the Android handsets in circulation. Planning a sprint to patch some of this up after the fat-tire updates are pulled in. Cheers

n8fr8 commented 6 years ago

It could the Camera2 wrapper component I chose "com.asksira.android:cameraviewplus:0.9.5" doesn't do a good job with being backwards compat. There are others we can look at using instead.

Also, I am seriously considering a very different implementation for video. The current approach is just not cutting it.

Otherwise, the fat-tire updates have been merged!