title: How to make video captured by front camera not being inverse Android?
body: <p>I recording video using MediaRecorder.When using back-camera,it working fine,but when using front camera,the video captured is being flipped/inverse.Means that the item in right,will appear on the left.The camera preview is working fine,just final captured video flipped.</p>
  
  <p><strong>Here is the camera preview looks like</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/EFwtK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EFwtK.png" alt="enter image description here"></a></p>
  
  <p><strong>But the final video appear like this</strong>(all the item in left hand side,appear on right hand side)</p>
  
  <p><a href="https://i.stack.imgur.com/lA5AL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lA5AL.png" alt="enter image description here"></a></p>
  
  <p><strong>What I tried so far:</strong> </p>
  
  <p>I tried to apply the <code>matrix</code> when prepare recorder,but it seems does change anything.</p>
  
  <pre><code>private boolean prepareRecorder(int cameraId){
  
      //# Create a new instance of MediaRecorder
      mRecorder = new MediaRecorder();
  
      setCameraDisplayOrientation(this,cameraId,mCamera);
      int angle = getVideoOrientationAngle(this,cameraId);
      mRecorder.setOrientationHint(angle);
  
      if(cameraId == Camera.CameraInfo.CAMERA_FACING_FRONT){
          Matrix matrix = new Matrix();
          matrix.preScale(1.0f,-1.0f);
      }
  
      //all other code to prepare recorder here
    }
  </code></pre>
  
  <p>I already read for all this question below,but all this seems didnt solve my problem.For information,I using <code>SurfaceView</code> for the camera preview,so this question here doesn't help.</p>
  
  <p>1) <a href="https://stackoverflow.com/questions/18455666/android-flip-front-camera-mirror-flipped-video">Android flip front camera mirror flipped video</a></p>
  
  <p>2) <a href="http://How%20to%20keep%20android%20from%20inverting%20the%20image%20from%20the%20front%20facing%20camera?" rel="noreferrer">How to keep android from inverting the image from the front facing camera?</a></p>
  
  <p>3) <a href="https://stackoverflow.com/questions/9754346/prevent-flipping-of-the-front-facing-camera/17569915#17569915">Prevent flipping of the front facing camera</a></p>
  
  <p><strong>So my question is :</strong> </p>
  
  <p>1) How to capture a video by front camera which the video not being inverse(exactly the same with camera preview)?</p>
  
  <p>2) How to achieve this when the Camera preview is using <code>SurfaceView</code> but not <code>TextureView</code> ? (cause all the question I mention above,tell about using <code>TextureView</code>)</p>
  
  <p>All possible solution is mostly welcome..Tq</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I made 2 short video clip to clarify the problem,please download and take a look</p>
  
  <p>1) <a href="https://uploadfiles.io/76rf2" rel="noreferrer">The video during camera preview of recording</a> </p>
  
  <p>2) <a href="https://uploadfiles.io/2l3uf" rel="noreferrer">The video of the final product of recording</a></p>