camera-samples icon indicating copy to clipboard operation
camera-samples copied to clipboard

No way to mimic AVAssetWriterInput in Android

Open darrinps opened this issue 4 years ago • 0 comments

Using CameraX 1.1.0-alpha02, there is not way to minic what iOS does with respect to taking the video buffer, modifying it with CISourceOverCompositing and then use the result to feed AVAssetWriterInput (save the video output). That allows them to easily do things like add overlays to video. We have no way to do that to this day on Android.

Given that we can pass frames to ImageAnalysis, the same mechanism should be able to be done where the final output feed is generated in Android's equivalent of CISourceOverCompositing (sample code available for that many places). It looks like two of the three components already exist then. Android can pull the frame and modify it. We just need a way to use the modified frame as the replacement for the original one in the stream.

So, outputFileOptions needs to be extended to take a frame/bitmap produced by a function (overlay function...the equivalent of CISourceOverCompositing), and then use that in videoCapture.startRecording

darrinps avatar Mar 04 '21 00:03 darrinps