我設法創建了一個android應用程序來錄製視頻,但問題是前置攝像頭視頻的方向。輸出不符合要求。它會自動旋轉。Android前置攝像頭錄製視頻但播放顛倒...!
應用程序方向是風景。所以,我需要在橫向模式下使用前置攝像頭進行錄製。
什麼都沒有解決。
我設法創建了一個android應用程序來錄製視頻,但問題是前置攝像頭視頻的方向。輸出不符合要求。它會自動旋轉。Android前置攝像頭錄製視頻但播放顛倒...!
應用程序方向是風景。所以,我需要在橫向模式下使用前置攝像頭進行錄製。
什麼都沒有解決。
你可能想看看AOSP VideoCamera activity是如何實現這一點:
if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
rotation = (info.orientation - mOrientation + 360) % 360;
} else { // back-facing camera
rotation = (info.orientation + mOrientation) % 360;
}
有在my answer for another question here一些更多的細節。
添加這個你開始你下面setVideoSource錄像
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
if (cameraId == 1) {
mediaRecorder.setProfile(CamcorderProfile
.get(CamcorderProfile.QUALITY_LOW));
mediaRecorder.setOrientationHint(270);
} else if (cameraId == 0) {
mediaRecorder.setProfile(CamcorderProfile
.get(CamcorderProfile.QUALITY_HIGH));
mediaRecorder.setOrientationHint(orientation);
}
mediaRecorder.setOrientationHint(270);
是前置攝像頭倒掛問題
我試過了。但它只是創建視頻的鏡像。 –
我嘗試使用 'mrec.setOrientationHint(0);' 在'私人void startRecording()'函數,但它不允許我啓動視頻 –
什麼是mOrientation?你能提供完整的代碼嗎?我正在嘗試從過去兩天重新支持它 –
@RahulKhurana,我將過時的omapzoom鏈接更新爲androidxref,以便您查看完整的代碼。 – Joe