I'm building my own camera application and I'm looking for a way to take a picture while recording a video. (android 15+)
Is this possible in CWAC-camera or should I cut a frame out of the video.
Thanks
Is this possible in CWAC-camera
Not that I am aware of.
should I cut a frame out of the video
It is possible that a PreviewCallback is invoked while MediaRecorder is recording. I have not experimented with that. If it is, my guess is that will give you better results than will grabbing a frame.
Related
I m working on a project, where I need to record video from camera. At the time of recording we are showing some text over screen. But we are not able to record that text along with preview part. Is this posible to record both.
I am using https://github.com/googlesamples/android-Camera2Video example to record video.
Please help.
I actually don't think that's possible. You can fetch video frames from a camera preview, but there's no good way to encode them back to video. The MediaRecorder can only record the actual direct camera input into a video file.
I will suggest you to look at MediaCodec and MediaMuxer
Also, see this post if you can use ffmpeg.
Hello android developers,
I am using camera API, and facing a problem which cause the front camera video flip mirror when finish record and display on videoView.
So is there a solution to scale the Camera/VideoView mirroring?
If the problem was in picture I could use matrix scale on the image.
Thanks for helping.
You cannot do this with MediaRecorder because it's not an orientation problem, it's about frames that you have to mirroir yourself to achieve this result.
The optimal solution is to use ffmpeg which is one of the best tool to do the video morroring with command line. With this tool you can still record with MediaRecorder and use ffmpeg command after recording to reverse frames but if your video is too large it can be long to treat and therefore does not meet the need.
Another way would be using OpenCV with ffmpeg to get the mirorred video at the end of the recording.
I want to use media recorder to record a video. Meanwhile, I need process the preview frame in real time.
I read many articles about this. It seems that while recording, no preview frame is possible.
Is this true? Does anyone know how to get the preview frame to show up while recording?
You may use onPreviewFrame callback function of PreviewCallback. Kindly refer android documentation for details.
Following SO question will also help you:
android-preview-processing-while-video-recording
I have tried by setting the videosize(width,height) for mediarecorder, but this has device compatibility issue, on few devices its crashing at mediarecorder.start();
If the device happens to support a square video size, you are welcome to use it. Most will not.
Vine, based on the last reports that I heard, does not use MediaRecorder. Instead, they use preview frames from the camera, which they crop to be square and assemble into a video. I do not know what Instagram does.
You are also welcome to record a non-square video, then post-process the video yourself to crop it to be square.
Is it possible to record video with overlay view? While recording the video I have displayed one small image on the overlay view. What I want to do is I want those overlay image along with the video recorded. So when I will open that recorded video, I will be able to see that overlapped image that recorded with video also.
Friends, I need this solution ASAP. Please suggest proper solution :)
Unfortunately, there is no way in the current Android API to get between the camera input and the encoder. Any solution would either involve capturing frames from the video source, overlaying the additional image, and then including an encoder for the captured frames. Even in native code with NEON optimizations on a fast system, this is going to be a slow process. Alternatively, the whole stream could be post-processed in a similar fashion, but this would also require a decoder.
For future reference: This is possible using the CameraView library, at least in "snapshot video" mode.