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

[BUG] Video surveillance doesn't work and influences the whole app #295

Open leonardoporpora opened 6 years ago

leonardoporpora commented 6 years ago

I'm using haven in my android phone, if video surveillance is enabled no log is recorded on the phone and sent to my Signal device, so if i enable video surveillance Haven doesn't work at all. My phone is a Samsung Galaxy J3 (2016) Version of Android 5.1.1 Kernel version 3.10.65-12057946

n8fr8 commented 6 years ago

I've been thinking of not using the MediaRecorder for video recording, and instead just capture multiple preview frames and encode them into an MP4.

n8fr8 commented 6 years ago

Using this for example: https://developer.android.com/reference/android/media/MediaCodec

lukeswitz commented 6 years ago

Great idea going the MediaCodec route, much less demanding of the device.

Note: Android 5.1 & below make device sounds despite muting the stream on video capture start/stop. Seems to be related to not using correct method.

n8fr8 commented 6 years ago

I have something working with JCodec now, but it is too slow. I've checked in some code that uses MediaCodec into my branch but not fully working yet.

n8fr8 commented 6 years ago

https://github.com/guardianproject/haven/blob/dev-cameraviewplus/src/main/java/org/havenapp/main/sensors/motion/Preview.java#L220

n8fr8 commented 6 years ago

Try latest 0.2.0 alpha 2 build. Video is improved, though low framerate for now.

ghost commented 6 years ago

@n8fr8,

I've been thinking of not using the MediaRecorder for video recording, and instead just capture multiple preview frames and encode them into an MP4.

In the interest of freedom and openness, I suggest these instead of MP4:

"video/x-vnd.on2.vp8" - VP8 video (i.e. video in .webm)
"video/x-vnd.on2.vp9" - VP9 video (i.e. video in .webm) 

and if audio is a separate choice, then "vorbis" would win the Richard Stallman seal of approval.

n8fr8 commented 6 years ago

Sure... it comes down to right now which formats we can easily encode into, and that apps like Signal or Orfox/Tor Browser can play back. We are using JCodec http://jcodec.org/ to do video encoding at the moment. We need to find a way to encode into VP8/9 and WebM in the software, not hardware layer...

This looks like a good place to start: https://github.com/magicsih/AndroidScreenCaster