问题描述
我正在尝试从 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 文章,例如 如何让安卓不反转前置摄像头的图像?
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);
这篇关于安卓翻转前置摄像头镜像翻转视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!