I'm trying to record a video from Android's front camera while displaying on surface view as well.
What I found out with the front camera is that it mirror flips the video during recording, even though the surface view shows a normal view.
Is there any way I can prevent this or fix it?
I read upon other stackoverflow articles like How to keep android from inverting the image from the front facing camera?
But it seems to be only talking about taking photos with the front camera and reversing the image, which I already fixed using matrix myself. However, it seems like using a matrix for a video does not work.
I don't have a solution, but it seems to me the key is:
MediaRecorder.setOrientationHint
I'm recording video in H264 and it doen't work for me :( But it might help you. did to try it?
In my case, i just need to horizontal-flip when playing it. When recording it's already flipped for mirror effect and as i see it's not possible to modify it. However below code solved my problem when playing.
You have to apply a matrix transformation, like such:
Assuming you don't resize anything the ration would be 1, making the non-front camera preScale obsolete.
In the documentation of the setDisplayOrientation method (http://developer.android.com/reference/android/hardware/Camera.html), we can find:
So your preview display should be flipped but not your recorded video. With your preview display, do you see yourself as looking into a mirror? If so, everything is working fine.