1

使用 SurfaceView 进行视频录制,一切都很好,但是录制时视频向左旋转了 90 度。

setContentView(R.layout.activity_video_capture);

SurfaceView cameraView = (SurfaceView) findViewById(R.id.videoview);
surfaceHolder = cameraView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
4

1 回答 1

3

尝试这个:

camera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
camera.setDisplayOrientation(90);
camera.unlock();
mediaRecorder = new MediaRecorder();
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
CamcorderProfile camcorderProfile_HQ = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
mediaRecorder.setProfile(camcorderProfile_HQ);
mediaRecorder.setOutputFile(getOutputMediaFile(2).toString());
mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.
mediaRecorder.setMaxFileSize(5000000); // Set max file size 5M
于 2014-11-03T09:51:00.703 回答