Android翻转前置镜头翻转视频 [英] Android flip front camera mirror flipped video

查看:1248
本文介绍了Android翻转前置镜头翻转视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Android的前置摄像头录制视频,同时在表面视图上显示。



我用前置摄像头发现的是,在录制过程中,镜子翻转视频,即使表面视图显示正常视图。

$ b $



我读过其他stackoverflow文章,例如如何让Android不要将图片从前面的相机?



但它似乎只是说用前置摄像头拍摄照片和反转图像,我已经使用矩阵自己固定。

解决方案

我没有一个解决方案,但它在我看来,关键是:



MediaRecorder.setOrientationHint


设置输出视频播放的方向提示。这个方法应该在prepare()之前调用。此方法在视频记录期间不会触发源视频帧旋转,但如果输出格式为 OutputFormat.THREE_GPP或OutputFormat.MPEG_4 ,则添加包含输出视频中旋转角度的合成矩阵,以便视频播放器可以选择正确的方向播放。请注意,有些视频播放器可能会在播放过程中忽略视频中的组合矩阵。


我在H264中录制视频doen't为我工作:(
但它可能会帮助你,试试吗?


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

Sets the orientation hint for output video playback. This method should be called before prepare(). This method will not trigger the source video frame to rotate during video recording, but to add a composition matrix containing the rotation angle in the output video if the output format is OutputFormat.THREE_GPP or OutputFormat.MPEG_4 so that a video player can choose the proper orientation for playback. Note that some video players may choose to ignore the compostion matrix in a video during playback.

I'm recording video in H264 and it doen't work for me :( But it might help you. did to try it?

这篇关于Android翻转前置镜头翻转视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆