2

I see that in Snapchat and Facebook , we can take a video with front camera without mirror effect. Is this a custom camera with native-code language or OpenGL or could we do it with the default camera tools (camera1 or camera2 , Surfaceview, TextureView...)

I have already seen those questions :

  1. How to record video in front camera using surfaceview without mirror effect?
  2. How to keep android from inverting the image from the front facing camera?
  3. Prevent flipping of the front facing camera
  4. Android flip front camera mirror flipped video

But they don't really resolve this issue.

Could anyone give me an idea how to disable mirror effect in front camera and record a video without this effect ?

Any help would be appreciated! Thanks,

Community
  • 1
  • 1
Imene Noomene
  • 3,035
  • 5
  • 18
  • 34
  • What is a mirror effect? – greenapps Mar 30 '17 at 10:26
  • With the front facing camera before you take a picture or a video everything looks normal, but when you take a video and display it . The images of the video are mirrored and reversed. Both Android phone and iPhone have mirror effect on their front camera ,you can test the camera of your phone. – Imene Noomene Mar 30 '17 at 10:32
  • Thanks. In the viewer of the Camera app the scene is mirrored indeed. But the final image shown by Gallery app is ok. So i do not understand the problem. – greenapps Mar 30 '17 at 10:40
  • The problem is that I want to create a video with the front camera without a mirror effect as for snapchat and facebook camera. But I have not found a solution yet – Imene Noomene Mar 30 '17 at 11:21
  • If you record video just using the standard MediaRecorder class, via either camera API, the recorded video will not be mirrored. Only the preview output is mirrored. How are you recording it now that you're ending up with a mirror? – Eddy Talvala Mar 30 '17 at 19:36
  • @Eddy exactly I want to prevent the output video from mirroring. I 'm recording the video via MediaRecorder and still have the same result. (Ps: Mirror effect is default behavior of the camera of any mobile phone , I just want to find a way to flip the images flowed from the video) – Imene Noomene Mar 30 '17 at 19:49
  • The mirror effect for the front camera is only applied to camera preview; recorded video is not flipped by default. I just verified this using a basic camera test app on a Google Pixel; what devices are you seeing alternative behavior on? – Eddy Talvala Apr 03 '17 at 22:00
  • I notice that we can control the symmetry of the camera preview but not the video unlike in Facebook and Snapchat camera , we can take video that looks same as the preview (with the frontal camera). There are new devices that have option in there settings in which mirroring can be deactivated [see here](https://www.youtube.com/watch?v=TO2VLioLFro) and [here](https://www.youtube.com/watch?v=HuMjRLiC_WM) – Imene Noomene Apr 04 '17 at 08:12
  • Snapchat went an extra mile to flip the recording, see more in my [answer](https://stackoverflow.com/a/47249032/192373) to a duplicate question. – Alex Cohn Dec 25 '17 at 21:28
  • My question has 8 months ago and this question has one month ago . The second one is duplicated question why did u close my question ? also I didn't find in the answer in the second post. This is not fair at all @AlexCohn – Imene Noomene Dec 26 '17 at 09:21
  • @ImeneNoomene you should not be upset. Duplicate is not a mark that has any measure of fault in it (unlike some other reasons to close a question). You did a good job to link to many related questions here, and I deeply appreciate your effort. I regret that your question passed under my radar before, but the rules of SO require that the 'duplicate' mark is set not for a question that is similar to an older one, but for questions that have answers elsewhere. – Alex Cohn Dec 26 '17 at 12:16
  • As for the answer, it is there: you can use MediaCodec (e.g. through the [tag:grapfika] library) to record your video. You can flip the pixels that go to the encoder on the basis of [ScaledDrawable2d](https://github.com/google/grafika/blob/master/src/com/android/grafika/ScaledDrawable2d.java) example, but I personally have not used it enough to give guarantees re: performance and limitations of such approach. – Alex Cohn Dec 26 '17 at 12:26

0 Answers0