I have not worked with an Android camera for a long time. However, as far as I remember
1) onPreviewCallback is not called during recording
He mentioned in several questions:
The onPreviewFrame camera is not called. How to display the cameraโs real-time preview during video recording?
2) I saw that it was processed in SipDroid and a couple of other Android SIP clients as follows (this was 1-2 years ago, so this method may be deprecated):
- A pipe was created
- The receiving pipe socket was wrapped in a FileDescriptor and passed to MediaRecorder setOutputFile
- The pipe sending connector is constantly read in the stream.
- This way you can get the content that is written to the file
- Now the question is how to work with content (since it is encoded with H.263 or H.264 and can mix with sound if you record video with sound).
- There were some heuristic algorithms that analyzed the content (however, this is a pain in the ass)
3) You can use onPreviewFrame + to run AudioRecorder and encode it yourself (using ffmpeg or something like that) into the mp4 file. Thus, you do not need to start MediaRecorder recording.
source share