问题描述
我正在尝试从 Android 的前置摄像头录制视频,同时在表面视图上显示.
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?
我阅读了其他 stackoverflow 文章,例如 如何防止android反转前置摄像头的图像?
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.
推荐答案
在我的情况下,我只需要在播放时水平翻转.录制时它已经翻转为镜像效果,我认为无法修改它.但是下面的代码解决了我在播放时遇到的问题.
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.
videoPlayer.setScaleX(-1);
这篇关于Android翻转前置摄像头后视镜翻转视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!