本文介绍了Android的摄像头和preVIEW方向 - 如何脱钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我刚出场直通android的。我的问题是关于方向。录制的视频有错误的方向,如果我在纵向模式启动。
在我的情况我修改preVIEW布局查看了一下 - !?现在有一些错误/任意纵横比,但录制的视频也确实有相同的(错误)宽高比

i just played thru the android camera tutorial. the problem i have is about orientation. the recorded videos have wrong orientation if i start in portrait mode.In my case i modified the layout of preview view a bit - now it has some wrong/arbitrary aspect ration but the recorded videos do also have the same (wrong) aspect ratio!?

为什么以及如何preVIEW和实际记录加上?有没有办法去耦它:录制的视频只记录摄像机提供什么

Why and how are preview and actual recording coupled? is there a way to decouple it: the recorded video should only record what the camera delivers.

那么如何创建一个相机应用,忽略了拍摄方向(或只使用方向将其存储在元数据),但它反映出在preVIEW(无关 - 肖像通过旋转手机变成横向)。有没有以正确的旋转操作相机的应用程序的例子?

So how to create a camera app that ignores orientation on recording (or uses orientation only to store it in metadata) but reflects it in preview (nothing to do - a portrait becomes landscape by rotating the phone). are there any examples of camera apps with correct rotation handling?

推荐答案

如果您要录制Android视频与默认不同的方向,你需要使用MediaRecorder的 setOrientationHint 方法。

If you want to record video on Android with a different orientation from the default, you need to use MediaRecorder's setOrientationHint method.

有没有摄像头preVIEW定向耦合(通过相机的 setDisplayOrientation 法)和记录取向,超越它们都缺省为沿装置的​​长边被取向。

There is no coupling of camera preview orientation (set by Camera's setDisplayOrientation method) and recording orientation, beyond that they both default to be oriented along the long side of the device.

如果您从横向更改应用的方向走,你需要调用相机的setDisplayOrientation适当调整preVIEW和媒体录像机的setOrientationHint改变拍摄方向,独立完成。

If you change your app's orientation away from landscape, you need to call Camera's setDisplayOrientation to properly adjust preview, and Media Recorder's setOrientationHint to change the recording orientation, independently.

Android的默认摄像头应用程序,在 AOSP ,妥善处理这一切。

Android's default camera application, available in AOSP, properly handles all this.

这篇关于Android的摄像头和preVIEW方向 - 如何脱钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 07:06