I want to encrypt video on the fly that android camera captures. So I need to tell android MediaRecorder
to write it video stream to my CipherOutputStream
. The problem is MediaRecorder.setOutputFile()
method accepts only FileDescriptor
and there is no way to get encrypting file descriptor from CipherOutputStream.
So my question is how can I either emulate FileDescriptor to receive data writes and do encryption manually or somehow convince MediaRecorder
to stream video into CipherOutputStream
.
Android full-disk encryption is based on dm-crypt , which is a kernel feature that works at the block device layer. Because of this, encryption works with Embedded MultiMediaCard (eMMC) and similar flash devices that present themselves to the kernel as block devices.
You can use LocalServerSocket and LocalSocket to implement what you want.
LocalServerSocket which provides the FileDescriptor via LocalServerSocket.getFileDescriptor()
Remember to put all steps into a new Thread.
I used those APIs to create on-the-fly stream processor with the Camera as stream source.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With